scb-wc-test 0.1.11 → 0.1.13

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.
Files changed (95) hide show
  1. package/all.js +2 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +34 -32
  4. package/mvc/components/all.js +1 -0
  5. package/mvc/components/scb-accordion/scb-accordion-item.js +21 -61
  6. package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
  7. package/mvc/components/scb-avatar/scb-avatar.js +1 -1
  8. package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +1 -1
  9. package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +1 -1
  10. package/mvc/components/scb-button/scb-button.js +1 -1
  11. package/mvc/components/scb-calendar-card/scb-calendar-card.js +165 -126
  12. package/mvc/components/scb-card/scb-card.js +223 -217
  13. package/mvc/components/scb-checkbox/scb-checkbox-group.js +1 -1
  14. package/mvc/components/scb-checkbox/scb-checkbox.js +9 -11
  15. package/mvc/components/scb-chips/scb-chip.js +1 -1
  16. package/mvc/components/scb-dialog/scb-dialog.js +2 -2
  17. package/mvc/components/scb-divider/scb-divider.js +43 -53
  18. package/mvc/components/scb-drawer/scb-drawer-item.js +2 -2
  19. package/mvc/components/scb-drawer/scb-drawer-section.js +4 -4
  20. package/mvc/components/scb-drawer/scb-drawer.js +1 -1
  21. package/mvc/components/scb-drawer/scb-sub-drawer.js +1 -1
  22. package/mvc/components/scb-fact-card/scb-fact-card-content.js +1 -1
  23. package/mvc/components/scb-fact-card/scb-fact-card.js +68 -55
  24. package/mvc/components/scb-footer/scb-footer-section.js +2 -2
  25. package/mvc/components/scb-footer/scb-footer.js +1 -1
  26. package/mvc/components/scb-grid/scb-grid-item.js +5 -3
  27. package/mvc/components/scb-grid/scb-grid.js +27 -10
  28. package/mvc/components/scb-grid/scb-stack.js +10 -6
  29. package/mvc/components/scb-header/scb-header-drawer-group.js +1 -1
  30. package/mvc/components/scb-header/scb-header-drawer-item.js +1 -1
  31. package/mvc/components/scb-header/scb-header-tab.js +1 -1
  32. package/mvc/components/scb-header/scb-header-utility.js +1 -1
  33. package/mvc/components/scb-header/scb-header.js +53 -49
  34. package/mvc/components/scb-icon-button/scb-icon-button.js +45 -80
  35. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +84 -58
  36. package/mvc/components/scb-link/scb-link.js +39 -16
  37. package/mvc/components/scb-list/scb-list-item.js +115 -37
  38. package/mvc/components/scb-list/scb-list.js +16 -7
  39. package/mvc/components/scb-menu/scb-menu-item.js +1 -1
  40. package/mvc/components/scb-menu/scb-menu.js +1 -1
  41. package/mvc/components/scb-menu/scb-sub-menu.js +1 -1
  42. package/mvc/components/scb-notification/scb-notification.js +1 -1
  43. package/mvc/components/scb-notification-card/scb-notification-card.js +187 -0
  44. package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +1 -1
  45. package/mvc/components/scb-radio-button/scb-radio-button.js +29 -36
  46. package/mvc/components/scb-radio-button/scb-radio-group.js +1 -1
  47. package/mvc/components/scb-search/scb-search.js +48 -37
  48. package/mvc/components/scb-snackbar/scb-snackbar.js +8 -8
  49. package/mvc/components/scb-status-pill/scb-status-pill.js +1 -1
  50. package/mvc/components/scb-switch/scb-switch.js +1 -1
  51. package/mvc/components/scb-tabs/scb-primary-tab.js +1 -1
  52. package/mvc/components/scb-tabs/scb-secondary-tab.js +1 -1
  53. package/mvc/components/scb-tabs/scb-tabs.js +1 -1
  54. package/mvc/components/scb-textfield/scb-textfield.js +1 -1
  55. package/mvc/components/scb-toc/scb-toc-item.js +1 -1
  56. package/mvc/components/scb-toc/scb-toc.js +2 -2
  57. package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
  58. package/mvc/vendor/vendor-material.js +232 -312
  59. package/mvc/vendor/vendor.js +19 -23
  60. package/package.json +6 -2
  61. package/scb-accordion/scb-accordion-item.js +47 -98
  62. package/scb-calendar-card/scb-calendar-card.d.ts +6 -4
  63. package/scb-calendar-card/scb-calendar-card.js +207 -154
  64. package/scb-card/scb-card.d.ts +8 -3
  65. package/scb-card/scb-card.js +265 -250
  66. package/scb-checkbox/scb-checkbox.d.ts +1 -0
  67. package/scb-checkbox/scb-checkbox.js +56 -49
  68. package/scb-divider/scb-divider.d.ts +16 -4
  69. package/scb-divider/scb-divider.js +63 -69
  70. package/scb-fact-card/scb-fact-card.d.ts +8 -7
  71. package/scb-fact-card/scb-fact-card.js +100 -78
  72. package/scb-grid/scb-grid-item.d.ts +7 -2
  73. package/scb-grid/scb-grid-item.js +47 -33
  74. package/scb-grid/scb-grid.d.ts +7 -3
  75. package/scb-grid/scb-grid.js +57 -21
  76. package/scb-grid/scb-stack.d.ts +5 -1
  77. package/scb-grid/scb-stack.js +57 -31
  78. package/scb-header/scb-header.d.ts +1 -2
  79. package/scb-header/scb-header.js +154 -162
  80. package/scb-icon-button/scb-icon-button.d.ts +15 -11
  81. package/scb-icon-button/scb-icon-button.js +149 -132
  82. package/scb-keyfigure-card/scb-keyfigure-card.d.ts +6 -1
  83. package/scb-keyfigure-card/scb-keyfigure-card.js +139 -93
  84. package/scb-link/scb-link.d.ts +1 -0
  85. package/scb-link/scb-link.js +65 -38
  86. package/scb-list/scb-list-item.d.ts +8 -5
  87. package/scb-list/scb-list-item.js +183 -73
  88. package/scb-list/scb-list.d.ts +5 -0
  89. package/scb-list/scb-list.js +71 -21
  90. package/scb-notification-card/scb-notification-card.d.ts +18 -0
  91. package/scb-notification-card/scb-notification-card.js +264 -0
  92. package/scb-radio-button/scb-radio-button.js +46 -53
  93. package/scb-search/scb-search.d.ts +8 -0
  94. package/scb-search/scb-search.js +176 -139
  95. package/scb-wc-test.bundle.js +1870 -1546
@@ -1,40 +1,39 @@
1
- import { css as u, LitElement as h, html as a } from "lit";
2
- import { property as s, customElement as b } from "lit/decorators.js";
3
- var m = Object.defineProperty, p = Object.getOwnPropertyDescriptor, l = (t, o, e, r) => {
4
- for (var i = r > 1 ? void 0 : r ? p(o, e) : o, d = t.length - 1, c; d >= 0; d--)
5
- (c = t[d]) && (i = (r ? c(o, e, i) : c(i)) || i);
6
- return r && i && m(o, e, i), i;
1
+ import { css as p, LitElement as m, html as s } from "lit";
2
+ import { property as d, customElement as f } from "lit/decorators.js";
3
+ import "@material/web/icon/icon.js";
4
+ import "../scb-tooltip/scb-tooltip.js";
5
+ var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (t, e, i, r) => {
6
+ for (var n = r > 1 ? void 0 : r ? v(e, i) : e, u = t.length - 1, a; u >= 0; u--)
7
+ (a = t[u]) && (n = (r ? a(e, i, n) : a(n)) || n);
8
+ return r && n && g(e, i, n), n;
7
9
  };
8
- let n = class extends h {
10
+ let o = class extends m {
9
11
  constructor() {
10
- super(...arguments), this.ariaLabel = "", this.variant = "standard", this.icon = "home", this.toggle = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.error = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__onChange = () => {
11
- const t = this.__lastBtn;
12
- this.dispatchEvent(new CustomEvent("change", {
13
- detail: { selected: !!(t != null && t.selected) },
14
- bubbles: !0,
15
- composed: !0
16
- }));
12
+ super(...arguments), this.ariaLabel = "", this.tooltip = "", this.variant = "standard", this.icon = "home", this.toggle = !1, this.selected = !1, this.toggleofficon = "add", this.toggleonicon = "remove", this.disabled = !1, this.__loadedVariants = /* @__PURE__ */ new Set(), this.__iconLoaded = !1, this.__onInnerChange = () => {
13
+ const t = this.__getMdHost(), e = !!(t != null && t.selected);
14
+ this.toggle && (this.selected = e), this.dispatchEvent(
15
+ new CustomEvent("change", {
16
+ detail: { selected: e },
17
+ bubbles: !0,
18
+ composed: !0
19
+ })
20
+ );
17
21
  };
18
22
  }
19
- __attachChangeListener() {
20
- var o, e, r;
21
- const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
22
- "md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
23
- );
24
- t && t !== this.__lastBtn && ((r = (e = this.__lastBtn) == null ? void 0 : e.removeEventListener) == null || r.call(e, "change", this.__onChange), t.addEventListener("change", this.__onChange), this.__lastBtn = t);
25
- }
26
23
  async firstUpdated() {
27
- await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener();
24
+ await this.__ensureDepsLoaded(), await this.updateComplete, this.__attachChangeListener(), this.__syncAria();
28
25
  }
29
26
  updated(t) {
30
- super.updated(t), t.has("disabled") && this.toggleAttribute("aria-disabled", this.disabled), t.has("variant") || t.has("icon") || t.has("toggle") ? this.__ensureDepsLoaded().then(() => queueMicrotask(() => this.__attachChangeListener())) : queueMicrotask(() => this.__attachChangeListener());
27
+ super.updated(t), t.has("variant") || t.has("toggle") || t.has("icon") || t.has("ariaLabel") || t.has("selected") || t.has("disabled") || t.has("tooltip") ? this.__ensureDepsLoaded().then(
28
+ () => queueMicrotask(() => {
29
+ this.__attachChangeListener(), this.__syncAria();
30
+ })
31
+ ) : queueMicrotask(() => this.__attachChangeListener());
31
32
  }
32
- // koppla loss lyssnare om host tas bort
33
33
  disconnectedCallback() {
34
- var t, o;
35
- super.disconnectedCallback(), (o = (t = this.__lastBtn) == null ? void 0 : t.removeEventListener) == null || o.call(t, "change", this.__onChange), this.__lastBtn = null;
34
+ var t, e, i;
35
+ super.disconnectedCallback(), (e = (t = this.__lastBtn) == null ? void 0 : t.removeEventListener) == null || e.call(t, "change", this.__onInnerChange), this.__lastBtn = null, (i = this.__ariaObserver) == null || i.disconnect();
36
36
  }
37
- // Ladda in rätt Material-komponenter vid behov (variant + ikon)
38
37
  async __ensureDepsLoaded() {
39
38
  if (!this.__loadedVariants.has(this.variant)) {
40
39
  switch (this.variant) {
@@ -55,154 +54,172 @@ let n = class extends h {
55
54
  }
56
55
  this.__iconLoaded || (await import("@material/web/icon/icon.js"), this.__iconLoaded = !0);
57
56
  }
58
- render() {
59
- const t = this.ariaLabel.trim() || this.icon, o = this.error ? "error" : void 0, e = a`
57
+ // Hämta md-* host. Om den är inuti <scb-tooltip>, sök i dess light DOM.
58
+ __getMdHost() {
59
+ const t = this.renderRoot.querySelector(
60
+ "md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
61
+ );
62
+ if (t) return t;
63
+ const e = this.renderRoot.querySelector("scb-tooltip");
64
+ if (e) {
65
+ const i = e.querySelector(
66
+ "md-filled-icon-button, md-outlined-icon-button, md-filled-tonal-icon-button, md-icon-button"
67
+ );
68
+ if (i) return i;
69
+ }
70
+ return null;
71
+ }
72
+ __getInnerButton(t) {
73
+ const e = t == null ? void 0 : t.shadowRoot;
74
+ return e ? e.querySelector("button") || e.querySelector('[role="button"]') : null;
75
+ }
76
+ // Ta bort alla native title-tooltips (förhindrar visning av t.ex. ikonnamn).
77
+ __stripNativeTitles(t) {
78
+ if (!t) return;
79
+ t.removeAttribute("title");
80
+ const e = this.__getInnerButton(t);
81
+ e == null || e.removeAttribute("title");
82
+ const i = t.shadowRoot;
83
+ i && i.querySelectorAll("[title]").forEach((r) => r.removeAttribute("title"));
84
+ }
85
+ __syncAria() {
86
+ var u;
87
+ const t = this.__getMdHost();
88
+ if (!t) return;
89
+ const e = this.__getInnerButton(t), i = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), r = this.getAttribute("aria-controls"), n = this.getAttribute("aria-expanded");
90
+ e && (i ? e.setAttribute("aria-label", i) : e.removeAttribute("aria-label"), r !== null ? e.setAttribute("aria-controls", r) : e.removeAttribute("aria-controls"), n !== null ? e.setAttribute("aria-expanded", n) : e.removeAttribute("aria-expanded"), e.removeAttribute("title")), t.removeAttribute("aria-label"), t.removeAttribute("aria-controls"), t.removeAttribute("aria-expanded"), t.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded"), this.__stripNativeTitles(t), (u = this.__ariaObserver) == null || u.disconnect(), this.__ariaObserver = new MutationObserver(() => {
91
+ const a = this.__getMdHost(), c = this.__getInnerButton(a);
92
+ if (!a || !c) return;
93
+ const b = (this.ariaLabel || this.getAttribute("aria-label") || "").trim() || this.icon.trim(), h = this.getAttribute("aria-controls"), _ = this.getAttribute("aria-expanded");
94
+ b ? c.setAttribute("aria-label", b) : c.removeAttribute("aria-label"), h !== null ? c.setAttribute("aria-controls", h) : c.removeAttribute("aria-controls"), _ !== null ? c.setAttribute("aria-expanded", _) : c.removeAttribute("aria-expanded"), this.__stripNativeTitles(a), a.removeAttribute("aria-label"), a.removeAttribute("aria-controls"), a.removeAttribute("aria-expanded"), a.removeAttribute("title"), this.hasAttribute("aria-label") && this.removeAttribute("aria-label"), this.hasAttribute("aria-controls") && this.removeAttribute("aria-controls"), this.hasAttribute("aria-expanded") && this.removeAttribute("aria-expanded");
95
+ }), this.__ariaObserver.observe(this, {
96
+ attributes: !0,
97
+ attributeFilter: ["aria-label", "aria-controls", "aria-expanded"]
98
+ });
99
+ }
100
+ __attachChangeListener() {
101
+ var e, i;
102
+ const t = this.__getMdHost();
103
+ t && t !== this.__lastBtn && ((i = (e = this.__lastBtn) == null ? void 0 : e.removeEventListener) == null || i.call(e, "change", this.__onInnerChange), t.addEventListener("change", this.__onInnerChange), this.__lastBtn = t), this.toggle && t && "selected" in t && (t.selected = this.selected), this.__stripNativeTitles(t || null);
104
+ }
105
+ __renderMd(t = !1) {
106
+ const e = !!t, i = s`
60
107
  <md-icon aria-hidden="true">${this.toggleofficon}</md-icon>
61
108
  <md-icon slot="selected" aria-hidden="true">${this.toggleonicon}</md-icon>
62
- `, r = a`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
63
- if (this.toggle) {
64
- const i = this.selected || !1;
109
+ `, r = s`<md-icon aria-hidden="true">${this.icon}</md-icon>`;
110
+ if (this.toggle)
65
111
  switch (this.variant) {
66
112
  case "filled":
67
- return a`
113
+ return s`
68
114
  <md-filled-icon-button
115
+ ?scb-tooltip-button=${e}
69
116
  toggle
70
- variant=${o}
117
+ ?selected=${this.selected}
71
118
  ?disabled=${this.disabled}
72
- aria-label=${t}
73
- aria-pressed="${i}"
74
- >${e}</md-filled-icon-button>
119
+ >${i}</md-filled-icon-button>
75
120
  `;
76
121
  case "outlined":
77
- return a`
122
+ return s`
78
123
  <md-outlined-icon-button
124
+ ?scb-tooltip-button=${e}
79
125
  toggle
80
- variant=${o}
126
+ ?selected=${this.selected}
81
127
  ?disabled=${this.disabled}
82
- aria-label=${t}
83
- aria-pressed="${i}"
84
- >${e}</md-outlined-icon-button>
128
+ >${i}</md-outlined-icon-button>
85
129
  `;
86
130
  case "filled-tonal":
87
- return a`
131
+ return s`
88
132
  <md-filled-tonal-icon-button
133
+ ?scb-tooltip-button=${e}
89
134
  toggle
90
- variant=${o}
135
+ ?selected=${this.selected}
91
136
  ?disabled=${this.disabled}
92
- aria-label=${t}
93
- aria-pressed="${i}"
94
- >${e}</md-filled-tonal-icon-button>
137
+ >${i}</md-filled-tonal-icon-button>
95
138
  `;
96
139
  default:
97
- return a`
140
+ return s`
98
141
  <md-icon-button
99
- role="button"
142
+ ?scb-tooltip-button=${e}
100
143
  toggle
101
- variant=${o}
144
+ ?selected=${this.selected}
102
145
  ?disabled=${this.disabled}
103
- aria-label=${t}
104
- aria-pressed="${i}"
105
- >${e}</md-icon-button>
146
+ >${i}</md-icon-button>
106
147
  `;
107
148
  }
108
- }
109
149
  switch (this.variant) {
110
150
  case "filled":
111
- return a`
112
- <md-filled-icon-button
113
- variant=${o}
114
- ?disabled=${this.disabled}
115
- aria-label=${t}
116
- >${r}</md-filled-icon-button>
151
+ return s`
152
+ <md-filled-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
153
+ ${r}
154
+ </md-filled-icon-button>
117
155
  `;
118
156
  case "outlined":
119
- return a`
120
- <md-outlined-icon-button
121
- variant=${o}
122
- ?disabled=${this.disabled}
123
- aria-label=${t}
124
- >${r}</md-outlined-icon-button>
157
+ return s`
158
+ <md-outlined-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
159
+ ${r}
160
+ </md-outlined-icon-button>
125
161
  `;
126
162
  case "filled-tonal":
127
- return a`
128
- <md-filled-tonal-icon-button
129
- variant=${o}
130
- ?disabled=${this.disabled}
131
- aria-label=${t}
132
- >${r}</md-filled-tonal-icon-button>
163
+ return s`
164
+ <md-filled-tonal-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
165
+ ${r}
166
+ </md-filled-tonal-icon-button>
133
167
  `;
134
168
  default:
135
- return a`
136
- <md-icon-button
137
- variant=${o}
138
- ?disabled=${this.disabled}
139
- aria-label=${t}
140
- >${r}</md-icon-button>
169
+ return s`
170
+ <md-icon-button ?scb-tooltip-button=${e} ?disabled=${this.disabled}>
171
+ ${r}
172
+ </md-icon-button>
141
173
  `;
142
174
  }
143
175
  }
176
+ render() {
177
+ const t = (this.tooltip || this.ariaLabel || "").trim();
178
+ return t ? s`
179
+ <scb-tooltip
180
+ variant="plain"
181
+ position="top"
182
+ trigger="hover"
183
+ .delay=${0.12}
184
+ .arrow=${!0}
185
+ supporting-text=${t}
186
+ >
187
+ ${this.__renderMd(!0)}
188
+ </scb-tooltip>
189
+ ` : this.__renderMd(!1);
190
+ }
144
191
  };
145
- n.styles = u`
146
- /*Error-styling på alla underliggande knappar*/
147
- :host([error]) md-filled-icon-button[variant='error'],
148
- :host([error]) md-outlined-icon-button[variant='error'],
149
- :host([error]) md-filled-tonal-icon-button[variant='error'],
150
- :host([error]) md-icon-button[variant='error'] {
151
- --md-sys-color-primary: var(--md-sys-color-error);
152
- --md-sys-color-on-primary: var(--md-sys-color-on-error);
153
- }
154
- :host([error]) md-outlined-icon-button[variant='error'] md-icon,
155
- :host([error]) md-icon-button[variant='error'] md-icon {
156
- color: var(--md-sys-color-error) !important;
157
- }
158
- :host([error]) md-outlined-icon-button[variant='error'] {
159
- --_outline-color: var(--md-sys-color-error);
160
- --md-outlined-icon-button-pressed-outline-color: var(--md-sys-color-error);
161
- }
162
- :host([error]) md-outlined-icon-button[variant='error']:hover {
163
- --md-outlined-icon-button-outline-width: 2px;
164
- }
165
- :host([error]) md-filled-tonal-icon-button[variant='error'] {
166
- --md-filled-tonal-icon-button-container-color: var(--md-sys-color-error-container);
167
- --md-filled-tonal-icon-button-label-text-color: var(--md-sys-color-on-error-container);
168
- --md-filled-tonal-icon-button-hover-label-text-color: var(--md-sys-color-on-error-container);
169
- --md-filled-tonal-icon-button-pressed-label-text-color: var(--md-sys-color-on-error-container);
170
- --md-filled-tonal-icon-button-focus-label-text-color: var(--md-sys-color-on-error-container);
171
- --md-filled-tonal-icon-button-icon-color: var(--md-sys-color-on-error-container);
172
- --md-filled-tonal-icon-button-hover-icon-color: var(--md-sys-color-on-error-container);
173
- --md-filled-tonal-icon-button-pressed-icon-color: var(--md-sys-color-on-error-container);
174
- --md-filled-tonal-icon-button-focus-icon-color: var(--md-sys-color-on-error-container);
175
- --md-filled-tonal-icon-button-hover-state-layer-color: var(--md-sys-color-on-error-container);
176
- --md-filled-tonal-icon-button-pressed-state-layer-color: var(--md-sys-color-on-error-container);
177
- }
178
- `;
192
+ o.styles = p``;
193
+ l([
194
+ d({ type: String, attribute: "aria-label" })
195
+ ], o.prototype, "ariaLabel", 2);
179
196
  l([
180
- s({ type: String, reflect: !0, attribute: "aria-label" })
181
- ], n.prototype, "ariaLabel", 2);
197
+ d({ type: String })
198
+ ], o.prototype, "tooltip", 2);
182
199
  l([
183
- s({ type: String })
184
- ], n.prototype, "variant", 2);
200
+ d({ type: String })
201
+ ], o.prototype, "variant", 2);
185
202
  l([
186
- s({ type: String })
187
- ], n.prototype, "icon", 2);
203
+ d({ type: String })
204
+ ], o.prototype, "icon", 2);
188
205
  l([
189
- s({ type: Boolean, reflect: !0 })
190
- ], n.prototype, "toggle", 2);
206
+ d({ type: Boolean, reflect: !0 })
207
+ ], o.prototype, "toggle", 2);
191
208
  l([
192
- s({ type: String })
193
- ], n.prototype, "toggleofficon", 2);
209
+ d({ type: Boolean, reflect: !0 })
210
+ ], o.prototype, "selected", 2);
194
211
  l([
195
- s({ type: String })
196
- ], n.prototype, "toggleonicon", 2);
212
+ d({ type: String })
213
+ ], o.prototype, "toggleofficon", 2);
197
214
  l([
198
- s({ type: Boolean, reflect: !0 })
199
- ], n.prototype, "disabled", 2);
215
+ d({ type: String })
216
+ ], o.prototype, "toggleonicon", 2);
200
217
  l([
201
- s({ type: Boolean, reflect: !0 })
202
- ], n.prototype, "error", 2);
203
- n = l([
204
- b("scb-icon-button")
205
- ], n);
218
+ d({ type: Boolean, reflect: !0 })
219
+ ], o.prototype, "disabled", 2);
220
+ o = l([
221
+ f("scb-icon-button")
222
+ ], o);
206
223
  export {
207
- n as ScbIconButton
224
+ o as ScbIconButton
208
225
  };
@@ -1,12 +1,17 @@
1
1
  import { LitElement } from 'lit';
2
2
  export declare class ScbKeyFigureCard extends LitElement {
3
- keyfigure: number;
3
+ keyfigure: number | string;
4
4
  subLabel: string;
5
5
  supportingText: string;
6
6
  cardHref: string;
7
7
  icon: string;
8
8
  size: 'standard' | 'large';
9
+ unit: string;
10
+ fullHeight: boolean;
11
+ fullWidth: boolean;
12
+ stretch: boolean;
9
13
  static styles: import('lit').CSSResult;
14
+ private formatNumber;
10
15
  render(): import('lit-html').TemplateResult<1>;
11
16
  firstUpdated(): void;
12
17
  }
@@ -1,119 +1,165 @@
1
- import { css as p, LitElement as g, html as r } from "lit";
2
- import { property as n, customElement as y } from "lit/decorators.js";
1
+ import { css as d, LitElement as u, html as a } from "lit";
2
+ import { property as s, customElement as g } from "lit/decorators.js";
3
3
  import "@material/web/icon/icon.js";
4
4
  import "@material/web/ripple/ripple.js";
5
- var h = Object.defineProperty, m = Object.getOwnPropertyDescriptor, c = (i, s, l, t) => {
6
- for (var a = t > 1 ? void 0 : t ? m(s, l) : s, o = i.length - 1, d; o >= 0; o--)
7
- (d = i[o]) && (a = (t ? d(s, l, a) : d(a)) || a);
8
- return t && a && h(s, l, a), a;
5
+ var h = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (e, t, o, n) => {
6
+ for (var l = n > 1 ? void 0 : n ? y(t, o) : t, c = e.length - 1, p; c >= 0; c--)
7
+ (p = e[c]) && (l = (n ? p(t, o, l) : p(l)) || l);
8
+ return n && l && h(t, o, l), l;
9
9
  };
10
- let e = class extends g {
10
+ let i = class extends u {
11
11
  constructor() {
12
- super(...arguments), this.keyfigure = 0, this.subLabel = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard";
12
+ super(...arguments), this.keyfigure = 0, this.subLabel = "", this.supportingText = "", this.cardHref = "", this.icon = "", this.size = "standard", this.unit = "", this.fullHeight = !1, this.fullWidth = !1, this.stretch = !1;
13
+ }
14
+ formatNumber(e) {
15
+ if (typeof e == "number")
16
+ return e.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
17
+ const t = Number(e);
18
+ return Number.isNaN(t) ? String(e) : t.toLocaleString("sv-SE").replace(/\u00A0/g, " ");
13
19
  }
14
20
  render() {
15
- const i = this.cardHref ? "clickable" : "", l = ((t) => typeof t == "number" ? t.toLocaleString("sv-SE").replace(/\u00A0/g, " ") : t)(this.keyfigure);
16
- return r`
17
- <div class="scb-keyfigure-card ${i} ${this.size}">
18
- ${this.cardHref ? r`<md-ripple></md-ripple>` : ""}
19
- ${this.icon ? r`<md-icon>${this.icon}</md-icon>` : ""}
20
- ${this.keyfigure ? r`
21
- <div class="keyfigure">
22
- ${l}
23
- ${this.cardHref ? r`<md-icon>arrow_forward</md-icon>` : l}
24
- </div>` : ""}
25
- ${this.subLabel ? r`
26
- <div class="sub-label">
27
- ${this.cardHref ? r`<a href="${this.subLabel}" tabindex="0">${this.subLabel}</a>` : this.subLabel}
28
- </div>` : ""}
29
- ${this.supportingText ? r`<div class="supporting-text">${this.supportingText}</div>` : ""}
30
- </div>
31
- `;
21
+ const e = !!this.cardHref, t = this.formatNumber(this.keyfigure);
22
+ return a`
23
+ <div
24
+ class="scb-keyfigure-card ${e ? "clickable" : ""} ${this.size}"
25
+ role=${e ? "link" : "group"}
26
+ tabindex=${e ? "0" : "-1"}
27
+ aria-label=${this.subLabel || ""}
28
+ >
29
+ ${e ? a`<md-ripple></md-ripple>` : ""}
30
+ ${this.icon ? a`<md-icon>${this.icon}</md-icon>` : ""}
31
+
32
+ ${this.keyfigure !== void 0 && this.keyfigure !== null && this.keyfigure !== "" ? a`
33
+ <div class="keyfigure">
34
+ <span class="value">
35
+ ${t}${this.unit ? a`<span class="unit">${this.unit}</span>` : ""}
36
+ </span>
37
+ ${e ? a`<md-icon>arrow_forward</md-icon>` : ""}
38
+ </div>
39
+ ` : ""}
40
+
41
+ ${this.subLabel ? a`
42
+ <div class="sub-label">
43
+ ${e ? a`<a href="${this.cardHref}" tabindex="-1">${this.subLabel}</a>` : this.subLabel}
44
+ </div>
45
+ ` : ""}
46
+
47
+ ${this.supportingText ? a`<div class="supporting-text">${this.supportingText}</div>` : ""}
48
+ </div>
49
+ `;
32
50
  }
33
51
  firstUpdated() {
34
52
  if (this.cardHref) {
35
- const i = this.renderRoot.querySelector(".scb-keyfigure-card");
36
- i && i.addEventListener("click", (s) => {
37
- s.target.closest("a") || (window.location.href = this.cardHref);
38
- });
53
+ const e = this.renderRoot.querySelector(".scb-keyfigure-card");
54
+ e && (e.addEventListener("click", (t) => {
55
+ t.target.closest("a") || (window.location.href = this.cardHref);
56
+ }), e.addEventListener("keydown", (t) => {
57
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), window.location.href = this.cardHref);
58
+ }));
39
59
  }
40
60
  }
41
61
  };
42
- e.styles = p`
43
- :host{ --scb-card-min-w: 360px; }
62
+ i.styles = d`
63
+ :host { --scb-keyfigure-card-max-w: var(--scb-card-max-w, 360px); }
64
+
44
65
  :host {
45
- max-width: var(--scb-card-min-w);
46
- width: fit-content;;
47
- display: block;
66
+ display: block;
67
+ box-sizing: border-box;
68
+ inline-size: 100%;
69
+ min-inline-size: 0;
70
+ max-inline-size: var(--scb-keyfigure-card-max-w);
48
71
  }
49
- .scb-keyfigure-card {
50
- color: var(--md-sys-color-on-surface);
51
- display: flex;
52
- flex-direction: column;
53
- gap: var(--spacing-3);
54
- width: fit-content;
55
- max-width: var(--scb-card-min-w);
56
- position: relative;
57
- border-radius: var(--md-sys-shape-corner-large);
58
- background: var(--md-sys-color-surface-dim);
59
- padding: var(--spacing-7) var(--spacing-6);
72
+ :host([full-width]) { max-inline-size: none; }
73
+ :host([stretch]), :host([full-height]) { block-size: 100%; }
74
+
75
+ :host([stretch]) .scb-keyfigure-card,
76
+ :host([full-height]) .scb-keyfigure-card {
77
+ block-size: 100%;
60
78
  }
61
- .keyfigure{
62
- letter-spacing: var(--md-sys-typescale-headline-small-Tracking);
63
- gap: var(--spacing-3);
64
- display: flex;
65
- justify-content: space-between;
66
- align-items: center;
67
- font-size: var(--md-sys-typescale-headline-large-size);
68
- font-weight: var(--weight-bold);
69
- line-height: var(--md-sys-typescale-headline-large-line-height);
70
- letter-spacing: var(--md-sys-typescale-headline-large-tracking);
79
+
80
+ .scb-keyfigure-card {
81
+ color: var(--md-sys-color-on-surface);
82
+ display: flex;
83
+ flex-direction: column;
84
+ gap: var(--spacing-3);
85
+ position: relative;
86
+ border-radius: var(--md-sys-shape-corner-large);
87
+ background: var(--md-sys-color-surface-dim);
88
+ padding: var(--spacing-7);
89
+ box-sizing: border-box;
90
+ inline-size: 100%;
91
+ max-inline-size: 100%;
92
+ overflow: hidden;
71
93
  }
72
- .sub-label a {
73
- color: inherit;
74
- text-decoration: none;
94
+
95
+ .keyfigure {
96
+ display: flex;
97
+ justify-content: space-between;
98
+ align-items: center;
99
+ gap: var(--spacing-3);
100
+ font-size: var(--md-sys-typescale-headline-large-size);
101
+ font-weight: var(--weight-bold);
102
+ line-height: var(--md-sys-typescale-headline-large-line-height);
103
+ letter-spacing: var(--md-sys-typescale-headline-large-tracking);
75
104
  }
105
+ .keyfigure .value { white-space: nowrap; }
106
+ .keyfigure .unit { margin-inline-start: .25em; }
107
+
76
108
  .sub-label {
77
- font-size: var(--md-sys-typescale-title-medium-size);
78
- font-weight: var(--weight-semibold);
79
- line-height: var(--md-sys-typescale-title-medium-line-height);
80
- letter-spacing: var(--md-sys-typescale-title-medium-tracking);
109
+ font-size: var(--md-sys-typescale-title-medium-size);
110
+ font-weight: var(--weight-semibold);
111
+ line-height: var(--md-sys-typescale-title-medium-line-height);
112
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking);
81
113
  }
114
+ .sub-label a { color: inherit; text-decoration: none; }
115
+
82
116
  .supporting-text {
83
- font-size: var(--md-sys-typescale-body-large-size);
84
- line-height: var(--md-sys-typescale-body-large-line-height);
85
- letter-spacing: var(--md-sys-typescale-body-large-tracking);
86
- }
87
- .scb-keyfigure-card.clickable {
88
- cursor: pointer;
117
+ font-size: var(--md-sys-typescale-body-large-size);
118
+ line-height: var(--md-sys-typescale-body-large-line-height);
119
+ letter-spacing: var(--md-sys-typescale-body-large-tracking);
89
120
  }
121
+
122
+ .scb-keyfigure-card.clickable { cursor: pointer; }
123
+
90
124
  .scb-keyfigure-card.large .keyfigure {
91
- font-size: var(--md-sys-typescale-display-medium-size);
92
- line-height: var(--md-sys-typescale-display-medium-line-height);
93
- letter-spacing: var(--md-sys-typescale-display-medium-tracking);
125
+ font-size: var(--md-sys-typescale-display-medium-size);
126
+ line-height: var(--md-sys-typescale-display-medium-line-height);
127
+ letter-spacing: var(--md-sys-typescale-display-medium-tracking);
94
128
  }
95
129
  `;
96
- c([
97
- n({ type: Number })
98
- ], e.prototype, "keyfigure", 2);
99
- c([
100
- n({ type: String, attribute: "sub-label" })
101
- ], e.prototype, "subLabel", 2);
102
- c([
103
- n({ type: String, attribute: "supporting-text" })
104
- ], e.prototype, "supportingText", 2);
105
- c([
106
- n({ type: String, attribute: "card-href" })
107
- ], e.prototype, "cardHref", 2);
108
- c([
109
- n({ type: String })
110
- ], e.prototype, "icon", 2);
111
- c([
112
- n({ type: String })
113
- ], e.prototype, "size", 2);
114
- e = c([
115
- y("scb-keyfigure-card")
116
- ], e);
130
+ r([
131
+ s({ attribute: "keyfigure" })
132
+ ], i.prototype, "keyfigure", 2);
133
+ r([
134
+ s({ type: String, attribute: "sub-label" })
135
+ ], i.prototype, "subLabel", 2);
136
+ r([
137
+ s({ type: String, attribute: "supporting-text" })
138
+ ], i.prototype, "supportingText", 2);
139
+ r([
140
+ s({ type: String, attribute: "card-href" })
141
+ ], i.prototype, "cardHref", 2);
142
+ r([
143
+ s({ type: String })
144
+ ], i.prototype, "icon", 2);
145
+ r([
146
+ s({ type: String })
147
+ ], i.prototype, "size", 2);
148
+ r([
149
+ s({ type: String })
150
+ ], i.prototype, "unit", 2);
151
+ r([
152
+ s({ type: Boolean, reflect: !0, attribute: "full-height" })
153
+ ], i.prototype, "fullHeight", 2);
154
+ r([
155
+ s({ type: Boolean, reflect: !0, attribute: "full-width" })
156
+ ], i.prototype, "fullWidth", 2);
157
+ r([
158
+ s({ type: Boolean, reflect: !0 })
159
+ ], i.prototype, "stretch", 2);
160
+ i = r([
161
+ g("scb-keyfigure-card")
162
+ ], i);
117
163
  export {
118
- e as ScbKeyFigureCard
164
+ i as ScbKeyFigureCard
119
165
  };
@@ -6,6 +6,7 @@ export declare class ScbLink extends LitElement {
6
6
  rel?: string;
7
7
  download?: string;
8
8
  disabled: boolean;
9
+ ariaLabel: string;
9
10
  static styles: import('lit').CSSResult;
10
11
  render(): TemplateResult;
11
12
  }