scb-wc-test 0.1.135 → 0.1.136

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,11 +1,34 @@
1
- import{a as f,n as d,i as _,x as u,t as b}from"../../vendor/vendor.js";import"./scb-accordion-item.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,i,a){try{customElements.get(s)||e(s,i,a)}catch(c){var o=String(c||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,g=t=>{throw TypeError(t)},n=(t,e,s,i)=>{for(var a=i>1?void 0:i?v(e,s):e,o=t.length-1,c;o>=0;o--)(c=t[o])&&(a=(i?c(e,s,a):c(a))||a);return i&&a&&m(e,s,a),a},y=(t,e,s)=>e.has(t)||g("Cannot "+s),S=(t,e,s)=>e.has(t)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),h=(t,e,s)=>(y(t,e,"access private method"),s),p,l;let r=class extends _{constructor(){super(...arguments),S(this,p),this.detached=!1,this.spacing="",this.spacingTop="",this.spacingBottom=""}render(){return u`
1
+ import{a as _,n as p,i as m,E as v,x as f,t as y}from"../../vendor/vendor.js";import"./scb-accordion-item.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,i,o){try{customElements.get(s)||e(s,i,o)}catch(r){var c=String(r||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var S=Object.defineProperty,k=Object.getOwnPropertyDescriptor,b=t=>{throw TypeError(t)},l=(t,e,s,i)=>{for(var o=i>1?void 0:i?k(e,s):e,c=t.length-1,r;c>=0;c--)(r=t[c])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&S(e,s,o),o},w=(t,e,s)=>e.has(t)||b("Cannot "+s),A=(t,e,s)=>e.has(t)?b("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),d=(t,e,s)=>(w(t,e,"access private method"),s),n,g,u,h;let a=class extends m{constructor(){super(...arguments),A(this,n),this.detached=!1,this.showCloseAll=!1,this.spacing="",this.spacingTop="",this.spacingBottom=""}render(){const t=this.detached&&this.showCloseAll;return f`
2
2
  <div class="scb-accordion" ?detached=${this.detached}>
3
+ ${t?f`
4
+ <div class="scb-accordion-actions" role="toolbar" aria-label="Accordionkontroller">
5
+ <scb-button
6
+ variant="text"
7
+ label="Öppna alla"
8
+ @click=${d(this,n,g)}
9
+ ></scb-button>
10
+
11
+ <scb-button
12
+ variant="text"
13
+ label="Stäng alla"
14
+ @click=${d(this,n,u)}
15
+ ></scb-button>
16
+ </div>
17
+ `:v}
18
+
3
19
  <slot></slot>
4
20
  </div>
5
- `}firstUpdated(){h(this,p,l).call(this)}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&h(this,p,l).call(this)}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}};p=new WeakSet;l=function(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,s=this.mapSpacingToken(this.spacingBottom)??t;e?this.style.setProperty("--scb-accordion-spacing-block-start",e):this.style.removeProperty("--scb-accordion-spacing-block-start"),s?this.style.setProperty("--scb-accordion-spacing-block-end",s):this.style.removeProperty("--scb-accordion-spacing-block-end")};r.styles=f`
21
+ `}firstUpdated(){d(this,n,h).call(this)}updated(t){(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&d(this,n,h).call(this)}_getDirectItems(){return Array.from(this.children).filter(t=>t.tagName==="SCB-ACCORDION-ITEM")}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}};n=new WeakSet;g=function(){!this.detached||!this.showCloseAll||this._getDirectItems().forEach(t=>t.setOpen(!0))};u=function(){!this.detached||!this.showCloseAll||this._getDirectItems().forEach(t=>t.setOpen(!1))};h=function(){const t=this.mapSpacingToken(this.spacing),e=this.mapSpacingToken(this.spacingTop)??t,s=this.mapSpacingToken(this.spacingBottom)??t;e?this.style.setProperty("--scb-accordion-spacing-block-start",e):this.style.removeProperty("--scb-accordion-spacing-block-start"),s?this.style.setProperty("--scb-accordion-spacing-block-end",s):this.style.removeProperty("--scb-accordion-spacing-block-end")};a.styles=_`
6
22
  :host {
7
23
  display: block;
8
24
  margin-block-start: var(--scb-accordion-spacing-block-start, 0);
9
25
  margin-block-end: var(--scb-accordion-spacing-block-end, 0);
10
26
  }
11
- `;n([d({type:Boolean,reflect:!0})],r.prototype,"detached",2);n([d({type:String,reflect:!0})],r.prototype,"spacing",2);n([d({type:String,attribute:"spacing-top",reflect:!0})],r.prototype,"spacingTop",2);n([d({type:String,attribute:"spacing-bottom",reflect:!0})],r.prototype,"spacingBottom",2);r=n([b("scb-accordion")],r);
27
+
28
+ .scb-accordion-actions {
29
+ display: flex;
30
+ justify-content: flex-end;
31
+ gap: var(--spacing-2, 4px);
32
+ padding-block-start: var(--spacing-2, 4px);
33
+ }
34
+ `;l([p({type:Boolean,reflect:!0})],a.prototype,"detached",2);l([p({type:Boolean,attribute:"show-close-all",reflect:!0})],a.prototype,"showCloseAll",2);l([p({type:String,reflect:!0})],a.prototype,"spacing",2);l([p({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",2);l([p({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",2);a=l([y("scb-accordion")],a);
@@ -1,4 +1,4 @@
1
- import{a as g,n as c,i as u,x as i,t as y}from"../../vendor/vendor.js";import"../scb-chip/scb-chip.js";import"../scb-segmented-button/scb-segmented-button.js";import"../scb-segmented-button/scb-segmented-item.js";import"../scb-accordion/scb-accordion.js";import"../scb-divider/scb-divider.js";import"../scb-horizontal-scroller/scb-horizontal-scroller.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-accordion/scb-accordion-item.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,n,a){try{customElements.get(s)||e(s,n,a)}catch(d){var o=String(d||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var f=Object.defineProperty,$=Object.getOwnPropertyDescriptor,m=t=>{throw TypeError(t)},l=(t,e,s,n)=>{for(var a=n>1?void 0:n?$(e,s):e,o=t.length-1,d;o>=0;o--)(d=t[o])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&f(e,s,a),a},S=(t,e,s)=>e.has(t)||m("Cannot "+s),_=(t,e,s)=>e.has(t)?m("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),p=(t,e,s)=>(S(t,e,"access private method"),s),h,b,v;let r=class extends u{constructor(){super(...arguments),_(this,h),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.spacing="",this.spacingTop="",this.spacingBottom=""}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}firstUpdated(t){const e=this.shadowRoot?.querySelector('slot[name="table"]');e&&(e.addEventListener("slotchange",()=>this._styleSlottedTable()),this._styleSlottedTable()),p(this,h,b).call(this)}updated(t){super.updated(t),this._styleSlottedTable(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&p(this,h,b).call(this)}_styleSlottedTable(){const t=this.shadowRoot?.querySelector('slot[name="table"]');if(!t)return;t.assignedElements({flatten:!0}).forEach(s=>{if(s.tagName==="TABLE"){const n=s;n.style.borderCollapse="collapse",n.style.width="100%",s.querySelectorAll("tbody tr:nth-child(odd)").forEach(a=>{a.style.background="var(--md-sys-color-surface-container)"}),s.querySelectorAll("th").forEach(a=>{const o=a;o.style.border="1px solid var(--md-sys-color-on-surface)",o.style.padding="8px"}),s.querySelectorAll("td").forEach(a=>{const o=a;o.style.border="1px solid var(--md-sys-color-on-surface)",o.style.padding="8px"}),s.querySelectorAll("tr").forEach(a=>{const o=Array.from(a.children).filter(d=>d.tagName==="TD"||d.tagName==="TH");o.length>0&&(o[0].style.borderLeft="none",o[o.length-1].style.borderRight="none")})}})}render(){switch(this.variant){case"Table":return i`
1
+ import{a as g,n as c,i as u,x as i,t as y}from"../../vendor/vendor.js";import"../scb-chip/scb-chip.js";import"../scb-segmented-button/scb-segmented-button.js";import"../scb-segmented-button/scb-segmented-item.js";import"../scb-accordion/scb-accordion.js";import"../scb-divider/scb-divider.js";import"../scb-horizontal-scroller/scb-horizontal-scroller.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-accordion/scb-accordion-item.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,n,a){try{customElements.get(s)||e(s,n,a)}catch(d){var o=String(d||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var f=Object.defineProperty,$=Object.getOwnPropertyDescriptor,m=t=>{throw TypeError(t)},l=(t,e,s,n)=>{for(var a=n>1?void 0:n?$(e,s):e,o=t.length-1,d;o>=0;o--)(d=t[o])&&(a=(n?d(e,s,a):d(a))||a);return n&&a&&f(e,s,a),a},S=(t,e,s)=>e.has(t)||m("Cannot "+s),_=(t,e,s)=>e.has(t)?m("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),p=(t,e,s)=>(S(t,e,"access private method"),s),h,b,v;let r=class extends u{constructor(){super(...arguments),_(this,h),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.spacing="",this.spacingTop="",this.spacingBottom=""}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}firstUpdated(t){const e=this.shadowRoot?.querySelector('slot[name="table"]');e&&(e.addEventListener("slotchange",()=>this._styleSlottedTable()),this._styleSlottedTable()),p(this,h,b).call(this)}updated(t){super.updated(t),this._styleSlottedTable(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom"))&&p(this,h,b).call(this)}_styleSlottedTable(){const t=this.shadowRoot?.querySelector('slot[name="table"]');if(!t)return;t.assignedElements({flatten:!0}).forEach(s=>{if(s.tagName==="TABLE"){const n=s;n.style.borderCollapse="collapse",n.style.width="100%",s.querySelectorAll("tbody tr:nth-child(odd)").forEach(a=>{a.style.background="var(--md-sys-color-surface-container)"}),s.querySelectorAll("th").forEach(a=>{const o=a;o.style.border="1px solid var(--md-sys-color-on-surface)",o.style.padding="8px"}),s.querySelectorAll("td").forEach(a=>{const o=a;o.style.border="1px solid var(--md-sys-color-on-surface)",o.style.padding="8px"}),s.querySelectorAll("tr").forEach(a=>{const o=Array.from(a.children).filter(d=>d.tagName==="TD"||d.tagName==="TH");o.length>0&&(o[0].style.borderLeft="none",o[o.length-1].style.borderRight="none")})}})}render(){switch(this.variant){case"Table":return i`
2
2
  <div part="container">
3
3
  <div class="header">
4
4
  ${this.title?i` <div class="label">${this.title}</div> `:""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc-test",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -365,5 +365,5 @@
365
365
  },
366
366
  "./mvc/*": "./mvc/*"
367
367
  },
368
- "buildHash": "C1A5B99E2049C574C4C358706337F56F1665BAD714124CBADBC0EC5D2C386B57"
368
+ "buildHash": "3E5EBD5E64A4E0110CEE48CD6CF1923FEB48083DC320DD6AC1396DE766962BD8"
369
369
  }
@@ -2,6 +2,7 @@ import { LitElement, TemplateResult } from 'lit';
2
2
  export declare class ScbAccordion extends LitElement {
3
3
  #private;
4
4
  detached: boolean;
5
+ showCloseAll: boolean;
5
6
  spacing: string;
6
7
  spacingTop: string;
7
8
  spacingBottom: string;
@@ -9,6 +10,7 @@ export declare class ScbAccordion extends LitElement {
9
10
  render(): TemplateResult;
10
11
  protected firstUpdated(): void;
11
12
  protected updated(changed: Map<string, unknown>): void;
13
+ private _getDirectItems;
12
14
  private mapSpacingToken;
13
15
  }
14
16
  declare global {
@@ -1,29 +1,50 @@
1
- import { css as m, LitElement as v, html as b } from "lit";
2
- import { property as n, customElement as f } from "lit/decorators.js";
1
+ import { css as u, LitElement as v, nothing as y, html as g } from "lit";
2
+ import { property as i, customElement as _ } from "lit/decorators.js";
3
3
  import "./scb-accordion-item.js";
4
- var y = Object.defineProperty, u = Object.getOwnPropertyDescriptor, g = (t) => {
4
+ import "../scb-button/scb-button.js";
5
+ var k = Object.defineProperty, S = Object.getOwnPropertyDescriptor, b = (t) => {
5
6
  throw TypeError(t);
6
- }, c = (t, e, s, a) => {
7
- for (var o = a > 1 ? void 0 : a ? u(e, s) : e, p = t.length - 1, l; p >= 0; p--)
8
- (l = t[p]) && (o = (a ? l(e, s, o) : l(o)) || o);
9
- return a && o && y(e, s, o), o;
10
- }, _ = (t, e, s) => e.has(t) || g("Cannot " + s), S = (t, e, s) => e.has(t) ? g("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), h = (t, e, s) => (_(t, e, "access private method"), s), i, d;
11
- let r = class extends v {
7
+ }, r = (t, e, s, n) => {
8
+ for (var a = n > 1 ? void 0 : n ? S(e, s) : e, l = t.length - 1, h; l >= 0; l--)
9
+ (h = t[l]) && (a = (n ? h(e, s, a) : h(a)) || a);
10
+ return n && a && k(e, s, a), a;
11
+ }, A = (t, e, s) => e.has(t) || b("Cannot " + s), C = (t, e, s) => e.has(t) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), p = (t, e, s) => (A(t, e, "access private method"), s), c, f, m, d;
12
+ let o = class extends v {
12
13
  constructor() {
13
- super(...arguments), S(this, i), this.detached = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
14
+ super(...arguments), C(this, c), this.detached = !1, this.showCloseAll = !1, this.spacing = "", this.spacingTop = "", this.spacingBottom = "";
14
15
  }
15
16
  render() {
16
- return b`
17
+ const t = this.detached && this.showCloseAll;
18
+ return g`
17
19
  <div class="scb-accordion" ?detached=${this.detached}>
20
+ ${t ? g`
21
+ <div class="scb-accordion-actions" role="toolbar" aria-label="Accordionkontroller">
22
+ <scb-button
23
+ variant="text"
24
+ label="Öppna alla"
25
+ @click=${p(this, c, f)}
26
+ ></scb-button>
27
+
28
+ <scb-button
29
+ variant="text"
30
+ label="Stäng alla"
31
+ @click=${p(this, c, m)}
32
+ ></scb-button>
33
+ </div>
34
+ ` : y}
35
+
18
36
  <slot></slot>
19
37
  </div>
20
38
  `;
21
39
  }
22
40
  firstUpdated() {
23
- h(this, i, d).call(this);
41
+ p(this, c, d).call(this);
24
42
  }
25
43
  updated(t) {
26
- (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && h(this, i, d).call(this);
44
+ (t.has("spacing") || t.has("spacingTop") || t.has("spacingBottom")) && p(this, c, d).call(this);
45
+ }
46
+ _getDirectItems() {
47
+ return Array.from(this.children).filter((t) => t.tagName === "SCB-ACCORDION-ITEM");
27
48
  }
28
49
  // Mappar spacing-värden till tokens eller fria CSS-värden.
29
50
  mapSpacingToken(t) {
@@ -33,33 +54,49 @@ let r = class extends v {
33
54
  return /^\d+$/.test(e) ? `var(--spacing-${Math.max(0, Math.min(14, parseInt(e, 10)))})` : e;
34
55
  }
35
56
  };
36
- i = /* @__PURE__ */ new WeakSet();
57
+ c = /* @__PURE__ */ new WeakSet();
58
+ f = function() {
59
+ !this.detached || !this.showCloseAll || this._getDirectItems().forEach((t) => t.setOpen(!0));
60
+ };
61
+ m = function() {
62
+ !this.detached || !this.showCloseAll || this._getDirectItems().forEach((t) => t.setOpen(!1));
63
+ };
37
64
  d = function() {
38
65
  const t = this.mapSpacingToken(this.spacing), e = this.mapSpacingToken(this.spacingTop) ?? t, s = this.mapSpacingToken(this.spacingBottom) ?? t;
39
66
  e ? this.style.setProperty("--scb-accordion-spacing-block-start", e) : this.style.removeProperty("--scb-accordion-spacing-block-start"), s ? this.style.setProperty("--scb-accordion-spacing-block-end", s) : this.style.removeProperty("--scb-accordion-spacing-block-end");
40
67
  };
41
- r.styles = m`
68
+ o.styles = u`
42
69
  :host {
43
70
  display: block;
44
71
  margin-block-start: var(--scb-accordion-spacing-block-start, 0);
45
72
  margin-block-end: var(--scb-accordion-spacing-block-end, 0);
46
73
  }
74
+
75
+ .scb-accordion-actions {
76
+ display: flex;
77
+ justify-content: flex-end;
78
+ gap: var(--spacing-2, 4px);
79
+ padding-block-start: var(--spacing-2, 4px);
80
+ }
47
81
  `;
48
- c([
49
- n({ type: Boolean, reflect: !0 })
50
- ], r.prototype, "detached", 2);
51
- c([
52
- n({ type: String, reflect: !0 })
53
- ], r.prototype, "spacing", 2);
54
- c([
55
- n({ type: String, attribute: "spacing-top", reflect: !0 })
56
- ], r.prototype, "spacingTop", 2);
57
- c([
58
- n({ type: String, attribute: "spacing-bottom", reflect: !0 })
59
- ], r.prototype, "spacingBottom", 2);
60
- r = c([
61
- f("scb-accordion")
62
- ], r);
82
+ r([
83
+ i({ type: Boolean, reflect: !0 })
84
+ ], o.prototype, "detached", 2);
85
+ r([
86
+ i({ type: Boolean, attribute: "show-close-all", reflect: !0 })
87
+ ], o.prototype, "showCloseAll", 2);
88
+ r([
89
+ i({ type: String, reflect: !0 })
90
+ ], o.prototype, "spacing", 2);
91
+ r([
92
+ i({ type: String, attribute: "spacing-top", reflect: !0 })
93
+ ], o.prototype, "spacingTop", 2);
94
+ r([
95
+ i({ type: String, attribute: "spacing-bottom", reflect: !0 })
96
+ ], o.prototype, "spacingBottom", 2);
97
+ o = r([
98
+ _("scb-accordion")
99
+ ], o);
63
100
  export {
64
- r as ScbAccordion
101
+ o as ScbAccordion
65
102
  };