scb-wc 0.1.33 → 0.1.35
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as
|
|
1
|
+
import{_ as A,b as E,g as S,h,y as g}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as d}from"../../vendor/decorate.js";import{n as T,t as c}from"../../vendor/assertClassBrand.js";import"../scb-button/scb-button.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,o,a){try{customElements.get(t)||e(t,o,a)}catch(p){var b=String(p||"");if(b.indexOf("already been used")===-1&&b.indexOf("NotSupportedError")===-1)throw p}}}}catch{}})();var r,u,n,l=(r=new WeakSet,u=class extends A{constructor(...e){super(...e),T(this,r),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._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}get _regionLabel(){return`${this.expanded?this.collapseButtonLabel:this.expandButtonLabel} – ${this._contentId}`}toggle(){this.expanded=!this.expanded}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}willUpdate(e){e.has("variant")&&(this._measureContent(!1),this._countElements(!1),c(r,this,m).call(this))}firstUpdated(){requestAnimationFrame(()=>{this._measureContent(),this._countElements(),c(r,this,m).call(this)});const e=this.shadowRoot?.querySelector("slot");e&&e.addEventListener("slotchange",()=>{requestAnimationFrame(()=>{this._measureContent(),this._countElements(),c(r,this,f).call(this),c(r,this,m).call(this)})}),c(r,this,_).call(this),c(r,this,f).call(this)}updated(e){(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom")||e.has("spacingLeft")||e.has("spacingRight"))&&c(r,this,_).call(this),e.has("itemsGap")&&(c(r,this,f).call(this),this._measureContent()),e.has("visibleElements")&&c(r,this,m).call(this),e.has("expanded")&&(c(r,this,f).call(this),c(r,this,m).call(this),this.dispatchEvent(new CustomEvent("expandedchange",{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}_measureContent(e=!0){if(this.variant==="height"){const t=this.shadowRoot?.querySelector("slot");if(t){const o=t.assignedNodes({flatten:!0});let a=0;o.forEach(p=>{if(p.nodeType===Node.ELEMENT_NODE){const s=p;a+=s.offsetHeight||s.scrollHeight||0}});const b=a;b!==this._contentHeight&&(this._contentHeight=b,e&&this.requestUpdate())}}}_countElements(e=!0){if(this.variant==="elements"){const t=this.shadowRoot?.querySelector("slot");if(t){const o=t.assignedNodes({flatten:!0}).filter(a=>a.nodeType===Node.ELEMENT_NODE).length;o!==this._elementCount&&(this._elementCount=o,e&&this.requestUpdate())}}}render(){if(this.variant==="height"){const e=this.expanded?`${this._contentHeight}px`:`${this.collapsedHeight}px`,t=this._contentHeight>this.collapsedHeight;return g`
|
|
2
2
|
<div
|
|
3
3
|
class="collapse-content ${this.expanded?"expanded":""}"
|
|
4
4
|
id="${this._contentId}"
|
|
@@ -8,7 +8,7 @@ import{_ as y,b as _,g as E,h as c,y as u}from"../../vendor/vendor.js";import"..
|
|
|
8
8
|
>
|
|
9
9
|
<slot></slot>
|
|
10
10
|
</div>
|
|
11
|
-
${t?
|
|
11
|
+
${t?g`
|
|
12
12
|
<scb-button
|
|
13
13
|
id="${this._contentId}-button"
|
|
14
14
|
@click="${this.toggle}"
|
|
@@ -20,7 +20,7 @@ import{_ as y,b as _,g as E,h as c,y as u}from"../../vendor/vendor.js";import"..
|
|
|
20
20
|
>
|
|
21
21
|
</scb-button>
|
|
22
22
|
`:""}
|
|
23
|
-
`}else{const e=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements,t=this._elementCount>e;return
|
|
23
|
+
`}else{const e=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements,t=this._elementCount>e;return g`
|
|
24
24
|
<div
|
|
25
25
|
class="collapse-content ${this.expanded?"expanded":""}"
|
|
26
26
|
id="${this._contentId}"
|
|
@@ -29,7 +29,7 @@ import{_ as y,b as _,g as E,h as c,y as u}from"../../vendor/vendor.js";import"..
|
|
|
29
29
|
>
|
|
30
30
|
<slot></slot>
|
|
31
31
|
</div>
|
|
32
|
-
${t?
|
|
32
|
+
${t?g`
|
|
33
33
|
<scb-button
|
|
34
34
|
id="${this._contentId}-button"
|
|
35
35
|
@click="${this.toggle}"
|
|
@@ -41,7 +41,7 @@ import{_ as y,b as _,g as E,h as c,y as u}from"../../vendor/vendor.js";import"..
|
|
|
41
41
|
>
|
|
42
42
|
</scb-button>
|
|
43
43
|
`:""}
|
|
44
|
-
`}}},
|
|
44
|
+
`}}},n=u,u._focusableSelector="a[href], area[href], button, input, select, textarea, iframe, object, embed, [contenteditable], [tabindex]",u._savedTabindexAttr="data-scb-collapse-prev-tabindex",u.styles=E`
|
|
45
45
|
:host {
|
|
46
46
|
display: block;
|
|
47
47
|
box-sizing: border-box;
|
|
@@ -78,4 +78,4 @@ import{_ as y,b as _,g as E,h as c,y as u}from"../../vendor/vendor.js";import"..
|
|
|
78
78
|
overflow: visible;
|
|
79
79
|
display: block;
|
|
80
80
|
}
|
|
81
|
-
`,
|
|
81
|
+
`,u);function _(){const i=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??i,t=this.mapSpacingToken(this.spacingBottom)??i,o=this.mapSpacingToken(this.spacingLeft),a=this.mapSpacingToken(this.spacingRight);e?this.style.setProperty("--scb-collapse-spacing-block-start",e):this.style.removeProperty("--scb-collapse-spacing-block-start"),t?this.style.setProperty("--scb-collapse-spacing-block-end",t):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"),a?this.style.setProperty("--scb-collapse-spacing-inline-end",a):this.style.removeProperty("--scb-collapse-spacing-inline-end")}function f(){const i=this.mapSpacingToken(this.itemsGap);i?this.style.setProperty("--scb-collapse-items-gap",i):this.style.removeProperty("--scb-collapse-items-gap");const e=this.shadowRoot?.querySelector("slot");e&&e.assignedNodes({flatten:!0}).filter(t=>t.nodeType===Node.ELEMENT_NODE).forEach((t,o)=>{const a=t;o===0||!i?a.style.removeProperty("margin-block-start"):a.style.setProperty("margin-block-start","var(--scb-collapse-items-gap)")})}function y(i,e){if(e)i.setAttribute("aria-hidden","true"),i.setAttribute("inert",""),i.hasAttribute("tabindex")&&i.setAttribute(n._savedTabindexAttr,i.getAttribute("tabindex")??""),i.setAttribute("tabindex","-1");else if(i.removeAttribute("aria-hidden"),i.removeAttribute("inert"),i.hasAttribute(n._savedTabindexAttr)){const t=i.getAttribute(n._savedTabindexAttr)??"";t===""?i.removeAttribute("tabindex"):i.setAttribute("tabindex",t),i.removeAttribute(n._savedTabindexAttr)}else i.getAttribute("tabindex")==="-1"&&i.removeAttribute("tabindex");Array.from(i.querySelectorAll(n._focusableSelector)).forEach(t=>{if(e)t.hasAttribute("tabindex")&&t.setAttribute(n._savedTabindexAttr,t.getAttribute("tabindex")??""),t.setAttribute("tabindex","-1");else if(t.hasAttribute(n._savedTabindexAttr)){const o=t.getAttribute(n._savedTabindexAttr)??"";o===""?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o),t.removeAttribute(n._savedTabindexAttr)}else t.getAttribute("tabindex")==="-1"&&t.removeAttribute("tabindex")})}function m(){const i=this.shadowRoot?.querySelector(".collapse-content"),e=this.shadowRoot?.querySelector("slot");if(!i||!e)return;const t=e.assignedNodes({flatten:!0}).filter(a=>a.nodeType===Node.ELEMENT_NODE);if(this.variant==="height"){i.removeAttribute("aria-hidden");const a=Math.max(0,this.collapsedHeight),b=i.getBoundingClientRect().top;t.forEach(s=>{s.classList.remove("scb-collapsed-hidden"),c(r,this,y).call(this,s,!1)});const p=[];t.forEach(s=>{s.matches(n._focusableSelector)&&p.push(s);const v=Array.from(s.querySelectorAll(n._focusableSelector));p.push(...v)}),p.forEach(s=>{const v=s.getBoundingClientRect().top-b;if(!this.expanded&&v>=a)s.hasAttribute("tabindex")&&s.setAttribute(n._savedTabindexAttr,s.getAttribute("tabindex")??""),s.setAttribute("tabindex","-1");else if(s.hasAttribute(n._savedTabindexAttr)){const x=s.getAttribute(n._savedTabindexAttr)??"";x===""?s.removeAttribute("tabindex"):s.setAttribute("tabindex",x),s.removeAttribute(n._savedTabindexAttr)}else s.getAttribute("tabindex")==="-1"&&s.removeAttribute("tabindex")});return}const o=typeof this.visibleElements=="string"?parseInt(this.visibleElements,10):this.visibleElements;t.forEach((a,b)=>{const p=!this.expanded&&b>=o;p?a.classList.add("scb-collapsed-hidden"):a.classList.remove("scb-collapsed-hidden"),c(r,this,y).call(this,a,p)})}d([h({type:String})],l.prototype,"variant",void 0);d([h({type:Number,attribute:"collapsed-height",reflect:!0})],l.prototype,"collapsedHeight",void 0);d([h({type:Number,attribute:"visible-elements",reflect:!0})],l.prototype,"visibleElements",void 0);d([h({type:Boolean,reflect:!0})],l.prototype,"expanded",void 0);d([h({type:String,attribute:"expand-button-label",reflect:!0})],l.prototype,"expandButtonLabel",void 0);d([h({type:String,attribute:"collapse-button-label",reflect:!0})],l.prototype,"collapseButtonLabel",void 0);d([h({type:String,reflect:!0})],l.prototype,"spacing",void 0);d([h({type:String,attribute:"spacing-top",reflect:!0})],l.prototype,"spacingTop",void 0);d([h({type:String,attribute:"spacing-bottom",reflect:!0})],l.prototype,"spacingBottom",void 0);d([h({type:String,attribute:"spacing-left",reflect:!0})],l.prototype,"spacingLeft",void 0);d([h({type:String,attribute:"spacing-right",reflect:!0})],l.prototype,"spacingRight",void 0);d([h({type:String,attribute:"items-gap",reflect:!0})],l.prototype,"itemsGap",void 0);l=n=d([S("scb-collapse")],l);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -437,5 +437,5 @@
|
|
|
437
437
|
},
|
|
438
438
|
"./mvc/*": "./mvc/*"
|
|
439
439
|
},
|
|
440
|
-
"buildHash": "
|
|
440
|
+
"buildHash": "1D0454126B2E8EF9DB4624E2D3109AC7EC2722291FF5F34960BCD4373E4F750C"
|
|
441
441
|
}
|
|
@@ -95,7 +95,7 @@ var o, s = class extends t {
|
|
|
95
95
|
}), this.#e(), this.#t();
|
|
96
96
|
}
|
|
97
97
|
updated(e) {
|
|
98
|
-
(e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && this.#e(), e.has("itemsGap") && (this.#t(), this._measureContent()), e.has("expanded") && (this.#t(), this.#r(), this.dispatchEvent(new CustomEvent("expandedchange", {
|
|
98
|
+
(e.has("spacing") || e.has("spacingTop") || e.has("spacingBottom") || e.has("spacingLeft") || e.has("spacingRight")) && this.#e(), e.has("itemsGap") && (this.#t(), this._measureContent()), e.has("visibleElements") && this.#r(), e.has("expanded") && (this.#t(), this.#r(), this.dispatchEvent(new CustomEvent("expandedchange", {
|
|
99
99
|
detail: { expanded: this.expanded },
|
|
100
100
|
bubbles: !0,
|
|
101
101
|
composed: !0
|
|
@@ -116,16 +116,35 @@ var o, s = class extends t {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
#r() {
|
|
119
|
+
let e = this.shadowRoot?.querySelector(".collapse-content"), t = this.shadowRoot?.querySelector("slot");
|
|
120
|
+
if (!e || !t) return;
|
|
121
|
+
let n = t.assignedNodes({ flatten: !0 }).filter((e) => e.nodeType === Node.ELEMENT_NODE);
|
|
119
122
|
if (this.variant === "height") {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
e.removeAttribute("aria-hidden");
|
|
124
|
+
let t = Math.max(0, this.collapsedHeight), r = e.getBoundingClientRect().top;
|
|
125
|
+
n.forEach((e) => {
|
|
126
|
+
e.classList.remove("scb-collapsed-hidden"), this.#n(e, !1);
|
|
127
|
+
});
|
|
128
|
+
let i = [];
|
|
129
|
+
n.forEach((e) => {
|
|
130
|
+
e.matches(o._focusableSelector) && i.push(e);
|
|
131
|
+
let t = Array.from(e.querySelectorAll(o._focusableSelector));
|
|
132
|
+
i.push(...t);
|
|
133
|
+
}), i.forEach((e) => {
|
|
134
|
+
let n = e.getBoundingClientRect().top - r;
|
|
135
|
+
if (!this.expanded && n >= t) e.hasAttribute("tabindex") && e.setAttribute(o._savedTabindexAttr, e.getAttribute("tabindex") ?? ""), e.setAttribute("tabindex", "-1");
|
|
136
|
+
else if (e.hasAttribute(o._savedTabindexAttr)) {
|
|
137
|
+
let t = e.getAttribute(o._savedTabindexAttr) ?? "";
|
|
138
|
+
t === "" ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", t), e.removeAttribute(o._savedTabindexAttr);
|
|
139
|
+
} else e.getAttribute("tabindex") === "-1" && e.removeAttribute("tabindex");
|
|
127
140
|
});
|
|
141
|
+
return;
|
|
128
142
|
}
|
|
143
|
+
let r = typeof this.visibleElements == "string" ? parseInt(this.visibleElements, 10) : this.visibleElements;
|
|
144
|
+
n.forEach((e, t) => {
|
|
145
|
+
let n = !this.expanded && t >= r;
|
|
146
|
+
n ? e.classList.add("scb-collapsed-hidden") : e.classList.remove("scb-collapsed-hidden"), this.#n(e, n);
|
|
147
|
+
});
|
|
129
148
|
}
|
|
130
149
|
_measureContent(e = !0) {
|
|
131
150
|
if (this.variant === "height") {
|
|
@@ -180,13 +199,7 @@ var o, s = class extends t {
|
|
|
180
199
|
`;
|
|
181
200
|
} else {
|
|
182
201
|
let e = typeof this.visibleElements == "string" ? parseInt(this.visibleElements, 10) : this.visibleElements, t = this._elementCount > e;
|
|
183
|
-
return
|
|
184
|
-
let t = this.shadowRoot?.querySelector("slot");
|
|
185
|
-
t && t.assignedNodes({ flatten: !0 }).filter((e) => e.nodeType === Node.ELEMENT_NODE).forEach((t, n) => {
|
|
186
|
-
let r = t;
|
|
187
|
-
!this.expanded && n >= e ? (r.classList.add("scb-collapsed-hidden"), this.#n(r, !0)) : (r.classList.remove("scb-collapsed-hidden"), this.#n(r, !1));
|
|
188
|
-
});
|
|
189
|
-
}, 0), r`
|
|
202
|
+
return r`
|
|
190
203
|
<div
|
|
191
204
|
class="collapse-content ${this.expanded ? "expanded" : ""}"
|
|
192
205
|
id="${this._contentId}"
|
package/scb-wc.bundle.js
CHANGED
|
@@ -5942,7 +5942,7 @@
|
|
|
5942
5942
|
overflow: visible;
|
|
5943
5943
|
display: block;
|
|
5944
5944
|
}
|
|
5945
|
-
`}toggle(){this.expanded=!this.expanded}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#e(){let e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,n=this.mapSpacingToken(this.spacingBottom)??e,r=this.mapSpacingToken(this.spacingLeft),i=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty(`--scb-collapse-spacing-block-start`,t):this.style.removeProperty(`--scb-collapse-spacing-block-start`),n?this.style.setProperty(`--scb-collapse-spacing-block-end`,n):this.style.removeProperty(`--scb-collapse-spacing-block-end`),r?this.style.setProperty(`--scb-collapse-spacing-inline-start`,r):this.style.removeProperty(`--scb-collapse-spacing-inline-start`),i?this.style.setProperty(`--scb-collapse-spacing-inline-end`,i):this.style.removeProperty(`--scb-collapse-spacing-inline-end`)}#t(){let e=this.mapSpacingToken(this.itemsGap);e?this.style.setProperty(`--scb-collapse-items-gap`,e):this.style.removeProperty(`--scb-collapse-items-gap`);let t=this.shadowRoot?.querySelector(`slot`);t&&t.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE).forEach((t,n)=>{let r=t;n===0||!e?r.style.removeProperty(`margin-block-start`):r.style.setProperty(`margin-block-start`,`var(--scb-collapse-items-gap)`)})}willUpdate(e){e.has(`variant`)&&(this._measureContent(!1),this._countElements(!1),this.#r())}firstUpdated(){requestAnimationFrame(()=>{this._measureContent(),this._countElements(),this.#r()});let e=this.shadowRoot?.querySelector(`slot`);e&&e.addEventListener(`slotchange`,()=>{requestAnimationFrame(()=>{this._measureContent(),this._countElements(),this.#t(),this.#r()})}),this.#e(),this.#t()}updated(e){(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`)||e.has(`spacingLeft`)||e.has(`spacingRight`))&&this.#e(),e.has(`itemsGap`)&&(this.#t(),this._measureContent()),e.has(`expanded`)&&(this.#t(),this.#r(),this.dispatchEvent(new CustomEvent(`expandedchange`,{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}#n(e,t){if(t)e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``),e.hasAttribute(`tabindex`)&&e.setAttribute(El._savedTabindexAttr,e.getAttribute(`tabindex`)??``),e.setAttribute(`tabindex`,`-1`);else if(e.removeAttribute(`aria-hidden`),e.removeAttribute(`inert`),e.hasAttribute(El._savedTabindexAttr)){let t=e.getAttribute(El._savedTabindexAttr)??``;t===``?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t),e.removeAttribute(El._savedTabindexAttr)}else e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`);Array.from(e.querySelectorAll(El._focusableSelector)).forEach(e=>{if(t)e.hasAttribute(`tabindex`)&&e.setAttribute(El._savedTabindexAttr,e.getAttribute(`tabindex`)??``),e.setAttribute(`tabindex`,`-1`);else if(e.hasAttribute(El._savedTabindexAttr)){let t=e.getAttribute(El._savedTabindexAttr)??``;t===``?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t),e.removeAttribute(El._savedTabindexAttr)}else e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`)})}#r(){
|
|
5945
|
+
`}toggle(){this.expanded=!this.expanded}mapSpacingToken(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#e(){let e=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??e,n=this.mapSpacingToken(this.spacingBottom)??e,r=this.mapSpacingToken(this.spacingLeft),i=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty(`--scb-collapse-spacing-block-start`,t):this.style.removeProperty(`--scb-collapse-spacing-block-start`),n?this.style.setProperty(`--scb-collapse-spacing-block-end`,n):this.style.removeProperty(`--scb-collapse-spacing-block-end`),r?this.style.setProperty(`--scb-collapse-spacing-inline-start`,r):this.style.removeProperty(`--scb-collapse-spacing-inline-start`),i?this.style.setProperty(`--scb-collapse-spacing-inline-end`,i):this.style.removeProperty(`--scb-collapse-spacing-inline-end`)}#t(){let e=this.mapSpacingToken(this.itemsGap);e?this.style.setProperty(`--scb-collapse-items-gap`,e):this.style.removeProperty(`--scb-collapse-items-gap`);let t=this.shadowRoot?.querySelector(`slot`);t&&t.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE).forEach((t,n)=>{let r=t;n===0||!e?r.style.removeProperty(`margin-block-start`):r.style.setProperty(`margin-block-start`,`var(--scb-collapse-items-gap)`)})}willUpdate(e){e.has(`variant`)&&(this._measureContent(!1),this._countElements(!1),this.#r())}firstUpdated(){requestAnimationFrame(()=>{this._measureContent(),this._countElements(),this.#r()});let e=this.shadowRoot?.querySelector(`slot`);e&&e.addEventListener(`slotchange`,()=>{requestAnimationFrame(()=>{this._measureContent(),this._countElements(),this.#t(),this.#r()})}),this.#e(),this.#t()}updated(e){(e.has(`spacing`)||e.has(`spacingTop`)||e.has(`spacingBottom`)||e.has(`spacingLeft`)||e.has(`spacingRight`))&&this.#e(),e.has(`itemsGap`)&&(this.#t(),this._measureContent()),e.has(`visibleElements`)&&this.#r(),e.has(`expanded`)&&(this.#t(),this.#r(),this.dispatchEvent(new CustomEvent(`expandedchange`,{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}#n(e,t){if(t)e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``),e.hasAttribute(`tabindex`)&&e.setAttribute(El._savedTabindexAttr,e.getAttribute(`tabindex`)??``),e.setAttribute(`tabindex`,`-1`);else if(e.removeAttribute(`aria-hidden`),e.removeAttribute(`inert`),e.hasAttribute(El._savedTabindexAttr)){let t=e.getAttribute(El._savedTabindexAttr)??``;t===``?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t),e.removeAttribute(El._savedTabindexAttr)}else e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`);Array.from(e.querySelectorAll(El._focusableSelector)).forEach(e=>{if(t)e.hasAttribute(`tabindex`)&&e.setAttribute(El._savedTabindexAttr,e.getAttribute(`tabindex`)??``),e.setAttribute(`tabindex`,`-1`);else if(e.hasAttribute(El._savedTabindexAttr)){let t=e.getAttribute(El._savedTabindexAttr)??``;t===``?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t),e.removeAttribute(El._savedTabindexAttr)}else e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`)})}#r(){let e=this.shadowRoot?.querySelector(`.collapse-content`),t=this.shadowRoot?.querySelector(`slot`);if(!e||!t)return;let n=t.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE);if(this.variant===`height`){e.removeAttribute(`aria-hidden`);let t=Math.max(0,this.collapsedHeight),r=e.getBoundingClientRect().top;n.forEach(e=>{e.classList.remove(`scb-collapsed-hidden`),this.#n(e,!1)});let i=[];n.forEach(e=>{e.matches(El._focusableSelector)&&i.push(e);let t=Array.from(e.querySelectorAll(El._focusableSelector));i.push(...t)}),i.forEach(e=>{let n=e.getBoundingClientRect().top-r;if(!this.expanded&&n>=t)e.hasAttribute(`tabindex`)&&e.setAttribute(El._savedTabindexAttr,e.getAttribute(`tabindex`)??``),e.setAttribute(`tabindex`,`-1`);else if(e.hasAttribute(El._savedTabindexAttr)){let t=e.getAttribute(El._savedTabindexAttr)??``;t===``?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t),e.removeAttribute(El._savedTabindexAttr)}else e.getAttribute(`tabindex`)===`-1`&&e.removeAttribute(`tabindex`)});return}let r=typeof this.visibleElements==`string`?parseInt(this.visibleElements,10):this.visibleElements;n.forEach((e,t)=>{let n=!this.expanded&&t>=r;n?e.classList.add(`scb-collapsed-hidden`):e.classList.remove(`scb-collapsed-hidden`),this.#n(e,n)})}_measureContent(e=!0){if(this.variant===`height`){let t=this.shadowRoot?.querySelector(`slot`);if(t){let n=t.assignedNodes({flatten:!0}),r=0;n.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e;r+=t.offsetHeight||t.scrollHeight||0}});let i=r;i!==this._contentHeight&&(this._contentHeight=i,e&&this.requestUpdate())}}}_countElements(e=!0){if(this.variant===`elements`){let t=this.shadowRoot?.querySelector(`slot`);if(t){let n=t.assignedNodes({flatten:!0}).filter(e=>e.nodeType===Node.ELEMENT_NODE).length;n!==this._elementCount&&(this._elementCount=n,e&&this.requestUpdate())}}}render(){if(this.variant===`height`){let e=this.expanded?`${this._contentHeight}px`:`${this.collapsedHeight}px`,t=this._contentHeight>this.collapsedHeight;return b`
|
|
5946
5946
|
<div
|
|
5947
5947
|
class="collapse-content ${this.expanded?`expanded`:``}"
|
|
5948
5948
|
id="${this._contentId}"
|
|
@@ -5964,7 +5964,7 @@
|
|
|
5964
5964
|
>
|
|
5965
5965
|
</scb-button>
|
|
5966
5966
|
`:``}
|
|
5967
|
-
`}else{let e=typeof this.visibleElements==`string`?parseInt(this.visibleElements,10):this.visibleElements,t=this._elementCount>e;return
|
|
5967
|
+
`}else{let e=typeof this.visibleElements==`string`?parseInt(this.visibleElements,10):this.visibleElements,t=this._elementCount>e;return b`
|
|
5968
5968
|
<div
|
|
5969
5969
|
class="collapse-content ${this.expanded?`expanded`:``}"
|
|
5970
5970
|
id="${this._contentId}"
|