scb-wc 0.1.263 → 0.1.264

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 (88) hide show
  1. package/README.md +19 -16
  2. package/all.d.ts +16 -0
  3. package/all.js +16 -0
  4. package/index.js +101 -85
  5. package/mvc/components/all.js +11 -0
  6. package/mvc/components/scb-accordion/scb-accordion-item.js +1 -1
  7. package/mvc/components/scb-accordion/scb-accordion.js +1 -1
  8. package/mvc/components/scb-app-bar/scb-app-bar.js +1 -1
  9. package/mvc/components/scb-avatar/scb-avatar.js +1 -1
  10. package/mvc/components/scb-button/scb-button.js +3 -3
  11. package/mvc/components/scb-calendar/scb-calendar.js +1 -1
  12. package/mvc/components/scb-calendar-card/scb-calendar-card.js +2 -2
  13. package/mvc/components/scb-card/scb-card.js +2 -2
  14. package/mvc/{vendor → components/scb-chevron}/scb-chevron.js +1 -1
  15. package/mvc/components/scb-cookies-consent/scb-cookies-consent.js +1 -1
  16. package/mvc/components/scb-datepicker/scb-datepicker.js +143 -0
  17. package/mvc/components/scb-dialog/scb-dialog.js +1 -1
  18. package/mvc/components/scb-drawer/scb-drawer.js +3 -3
  19. package/mvc/components/scb-drop-zone/scb-drop-zone.js +1 -1
  20. package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
  21. package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
  22. package/mvc/components/scb-header/scb-header.js +2 -2
  23. package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +6 -6
  24. package/mvc/components/scb-icon-button/scb-icon-button.js +5 -5
  25. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -6
  26. package/mvc/components/scb-link/scb-link.js +1 -1
  27. package/mvc/components/scb-link-button/scb-link-button.js +1 -1
  28. package/mvc/components/scb-list/scb-list-item.js +6 -6
  29. package/mvc/components/scb-menu/scb-menu-item.js +1 -1
  30. package/mvc/components/scb-nav/scb-nav.js +1 -1
  31. package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
  32. package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
  33. package/mvc/components/scb-options-menu/scb-options-menu.js +2 -2
  34. package/mvc/components/scb-options-menu/scb-options-sub-menu.js +1 -1
  35. package/mvc/components/scb-overlay/scb-overlay.js +3 -3
  36. package/mvc/components/scb-pagination/scb-pagination.js +1 -1
  37. package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
  38. package/mvc/components/scb-search/scb-search.js +3 -3
  39. package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
  40. package/mvc/components/scb-select/scb-select-option.js +1 -1
  41. package/mvc/components/scb-select/scb-select.js +1 -1
  42. package/mvc/components/scb-snackbar/scb-snackbar.js +1 -1
  43. package/mvc/components/scb-stepper/scb-step.js +1 -1
  44. package/mvc/components/scb-table/scb-table.js +1 -1
  45. package/mvc/components/scb-table-advanced/scb-table-advanced.js +1 -1
  46. package/mvc/components/scb-table-next/read-table.js +1 -0
  47. package/mvc/components/scb-table-next/scb-table-next.js +6 -0
  48. package/mvc/components/scb-textfield/scb-textfield.js +34 -176
  49. package/mvc/components/scb-toc/scb-toc-item.js +1 -1
  50. package/mvc/components/scb-tooltip/scb-tooltip.js +2 -2
  51. package/mvc/components/scb-tour/scb-tour-step.js +1 -0
  52. package/mvc/components/scb-tour/scb-tour.js +33 -0
  53. package/mvc/{vendor → components/shared}/component-size-token.js +1 -1
  54. package/mvc/components/shared/lazy-focus-ring.js +2 -0
  55. package/mvc/components/shared/lazy-ripple.js +2 -0
  56. package/mvc/{vendor → components/shared}/manual-popover.js +1 -1
  57. package/mvc/components/shared/scb-icon-svg.js +11 -0
  58. package/mvc/vendor/scb-card-variants.internal.js +5 -5
  59. package/package.json +22 -2
  60. package/scb-card/scb-card-variants.internal.js +37 -40
  61. package/scb-components/index.d.ts +110 -0
  62. package/scb-components/scb-table-next/read-table.d.ts +29 -0
  63. package/scb-components/scb-table-next/scb-table-next.d.ts +22 -0
  64. package/scb-components/scb-tour/scb-tour-step.d.ts +13 -0
  65. package/scb-components/scb-tour/scb-tour.d.ts +57 -0
  66. package/scb-components/scb-viz/scb-viz-actions-runtime.d.ts +26 -0
  67. package/scb-components/scb-viz/scb-viz-print-runtime.d.ts +36 -0
  68. package/scb-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +21 -0
  69. package/scb-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +42 -0
  70. package/scb-components/scb-viz/scb-viz-table-runtime.d.ts +31 -0
  71. package/scb-components/shared/component-size-token.d.ts +1 -0
  72. package/scb-components/shared/lazy-focus-ring.d.ts +4 -0
  73. package/scb-components/shared/lazy-ripple.d.ts +9 -0
  74. package/scb-components/shared/manual-popover.d.ts +7 -0
  75. package/scb-components/shared/scb-icon-svg.d.ts +3 -0
  76. package/scb-table-next/read-table.js +87 -0
  77. package/scb-table-next/scb-table-next.js +226 -0
  78. package/scb-tooltip/scb-tooltip.js +7 -1
  79. package/scb-tour/scb-tour-step.js +27 -0
  80. package/scb-tour/scb-tour.js +368 -0
  81. package/scb-viz/scb-viz-series-differentiation-registry.js +10 -7
  82. package/scb-viz/scb-viz.js +43 -43
  83. package/scb-wc.bundle.js +588 -291
  84. package/scb-wc.d.ts +32 -0
  85. package/shared/scb-icon-svg.js +5 -2
  86. package/mvc/vendor/lazy-focus-ring.js +0 -2
  87. package/mvc/vendor/lazy-ripple.js +0 -2
  88. package/mvc/vendor/scb-icon-svg.js +0 -11
@@ -0,0 +1,226 @@
1
+ import e from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
2
+ import { readTable as t } from "./read-table.js";
3
+ import { LitElement as n, css as r, html as i, nothing as a } from "lit";
4
+ import { customElement as o, state as s } from "lit/decorators.js";
5
+ import { ifDefined as c } from "lit/directives/if-defined.js";
6
+ //#region src/scb-components/scb-table-next/scb-table-next.ts
7
+ var l = 200, u = /* @__PURE__ */ new WeakSet(), d = r`
8
+ scb-table-next > table {
9
+ box-sizing: border-box;
10
+ inline-size: 100%;
11
+ border-collapse: separate;
12
+ border-spacing: 0;
13
+ border: 0;
14
+ /* Ramen överlappar cellkanterna så att ytterlinjerna förblir 1 px. */
15
+ outline: 1px solid var(--scb-tables-strong-outline-color);
16
+ outline-offset: -1px;
17
+ border-radius: var(--md-sys-shape-corner-small);
18
+ overflow: hidden;
19
+ background: var(--scb-tables-surface-color);
20
+ color: inherit;
21
+ font: inherit;
22
+ }
23
+ scb-table-next > table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
24
+ box-sizing: border-box;
25
+ padding: var(--spacing-3) var(--spacing-4);
26
+ min-inline-size: 2.5rem;
27
+ border-block-end: 1px solid var(--scb-tables-strong-outline-color);
28
+ border-inline-end: 1px solid var(--scb-tables-strong-outline-color);
29
+ font-variant-numeric: tabular-nums;
30
+ font-weight: inherit;
31
+ }
32
+ scb-table-next > table > :is(thead, tbody, tfoot) > tr > th,
33
+ scb-table-next > table > tbody > tr > .forspalt { background: var(--scb-tables-alternate-surface-color); }
34
+ scb-table-next > table > thead > tr > * { background: var(--scb-tables-alternate-surface-color); }
35
+ scb-table-next > table > thead > tr > th { font-weight: var(--weight-bold); text-align: center; }
36
+ scb-table-next > table > thead > tr:last-child > th { text-align: end; }
37
+ scb-table-next > table > :is(tbody, tfoot) > tr > :is(th, td) { text-align: end; }
38
+ scb-table-next > table > :is(tbody, tfoot) > tr > :first-child,
39
+ scb-table-next > table > :is(tbody, tfoot) > tr > .forspalt,
40
+ scb-table-next > table > :is(tbody, tfoot) > tr > th:is([scope="row"], [scope="rowgroup"]) { text-align: start; }
41
+ scb-table-next > table > tbody > tr > .forspalt { min-inline-size: 0; }
42
+ scb-table-next > table > tbody > tr > :first-child:not(:has(~ th, ~ .forspalt)) { min-inline-size: 0; }
43
+ scb-table-next > table > tbody > tr:hover > * { background: var(--scb-tables-alternate-surface-color); }
44
+ scb-table-next > table a { color: inherit; text-decoration: underline; }
45
+ scb-table-next > table a:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
46
+ `, f = class extends n {
47
+ constructor(...e) {
48
+ super(...e), this._mobile = !1, this._widthReady = !1;
49
+ }
50
+ static {
51
+ this.styles = r`
52
+ :host {
53
+ display: block;
54
+ min-inline-size: 0;
55
+ color: var(--scb-tables-content-color, var(--md-sys-color-on-surface));
56
+ font-family: var(--scb-tables-cell-font, var(--brand-font, Inter, Arial, sans-serif));
57
+ font-size: var(--scb-tables-cell-size);
58
+ line-height: var(--scb-tables-cell-line-height);
59
+ font-weight: var(--weight-regular);
60
+ }
61
+ * { box-sizing: border-box; }
62
+ :host([hidden]), [hidden] { display: none !important; }
63
+ .scroll { max-inline-size: 100%; overflow-x: auto; padding-bottom: var(--spacing-8, 24px); }
64
+ .scroll::-webkit-scrollbar {
65
+ border-radius: var(--md-sys-shape-corner-large);
66
+ height: 8px;
67
+ width: 10px;
68
+ }
69
+ .scroll::-webkit-scrollbar-thumb {
70
+ background: var(--scb-tables-scrollbar-thumb-color, var(--md-sys-color-on-surface));
71
+ border-radius: var(--md-sys-shape-corner-large);
72
+ cursor: pointer;
73
+ }
74
+ .scroll::-webkit-scrollbar-track {
75
+ background: var(--scb-tables-scrollbar-track-color, var(--md-sys-color-secondary-container));
76
+ border-radius: var(--md-sys-shape-corner-large);
77
+ }
78
+ a { color: inherit; text-decoration: underline; }
79
+ a:focus-visible, .scroll:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
80
+ table {
81
+ inline-size: 100%;
82
+ border-collapse: separate;
83
+ border-spacing: 0;
84
+ border: 1px solid var(--scb-tables-strong-outline-color);
85
+ border-radius: var(--md-sys-shape-corner-small);
86
+ overflow: hidden;
87
+ background: var(--scb-tables-surface-color);
88
+ color: inherit;
89
+ font: inherit;
90
+ }
91
+ th, td {
92
+ min-inline-size: 2.5rem;
93
+ font-variant-numeric: tabular-nums;
94
+ font-weight: inherit;
95
+ }
96
+ .stub { text-align: start; }
97
+ td { text-align: end; }
98
+ tbody tr:hover > * { background: var(--scb-tables-alternate-surface-color); }
99
+ .mobile th, .mobile td {
100
+ padding-block: var(--spacing-2);
101
+ padding-inline: var(--spacing-5);
102
+ border: 0;
103
+ background: transparent;
104
+ vertical-align: top;
105
+ }
106
+ .mobile .stub {
107
+ min-inline-size: 0;
108
+ padding-inline-end: calc(var(--spacing-1) / 2);
109
+ }
110
+ .mobile td { inline-size: 1%; white-space: nowrap; }
111
+ .mobile .stub-headings > th { text-align: start; font-weight: var(--weight-bold); }
112
+ .mobile .stub-headings > th:empty { padding: 0; }
113
+ .mobile .outer > th {
114
+ padding-block: var(--spacing-5);
115
+ background: var(--scb-tables-alternate-surface-color);
116
+ font-weight: var(--weight-bold);
117
+ text-align: start;
118
+ border-block-start: 1px solid var(--scb-tables-strong-outline-color);
119
+ }
120
+ .mobile tbody:first-child > .outer:first-child > th { border-block-start: 0; }
121
+ .mobile .group > th {
122
+ padding-block-start: 0;
123
+ font-weight: var(--weight-bold);
124
+ text-align: start;
125
+ }
126
+ .mobile .group.first > th { padding-block-start: calc(var(--spacing-8) + var(--spacing-2)); }
127
+ .mobile .last > * { padding-block-end: calc(var(--spacing-8) + var(--spacing-2)); }
128
+ `;
129
+ }
130
+ connectedCallback() {
131
+ super.connectedCallback();
132
+ let e = this.getRootNode();
133
+ if (!u.has(e)) {
134
+ let t = this.ownerDocument.createElement("style");
135
+ t.textContent = d.cssText, (e instanceof Document ? e.head : e).appendChild(t), u.add(e);
136
+ }
137
+ this._observer = new MutationObserver(() => this._queueRead()), this._observer.observe(this, {
138
+ childList: !0,
139
+ characterData: !0,
140
+ subtree: !0,
141
+ attributes: !0,
142
+ attributeFilter: [
143
+ "colspan",
144
+ "rowspan",
145
+ "aria-label",
146
+ "role",
147
+ "tabindex",
148
+ "contenteditable",
149
+ "scope",
150
+ "class",
151
+ "hidden",
152
+ "href",
153
+ "title",
154
+ "id",
155
+ "target",
156
+ "download",
157
+ "aria-labelledby",
158
+ "aria-describedby"
159
+ ]
160
+ }), this._resize = new ResizeObserver(([e]) => {
161
+ let t = e.contentRect.width;
162
+ if (t <= 0) {
163
+ this._widthReady = !1;
164
+ return;
165
+ }
166
+ let n = t <= 575, r = n !== this._mobile;
167
+ this._mobile = n, (!this._widthReady || r) && (this._widthReady = !0, this._read());
168
+ }), this._resize.observe(this);
169
+ }
170
+ disconnectedCallback() {
171
+ this._observer?.disconnect(), this._resize?.disconnect(), this._frame !== void 0 && cancelAnimationFrame(this._frame), this._frame = void 0, this._widthReady = !1, super.disconnectedCallback();
172
+ }
173
+ _queueRead() {
174
+ !this._mobile || !this._widthReady || this._frame !== void 0 || (this._frame = requestAnimationFrame(() => {
175
+ this._frame = void 0, this._read();
176
+ }));
177
+ }
178
+ _read() {
179
+ if (!this._widthReady) return;
180
+ if (!this._mobile) {
181
+ this._model = void 0;
182
+ return;
183
+ }
184
+ let e = this.querySelectorAll("table");
185
+ try {
186
+ this._model = e.length === 1 ? t(e[0], l) : void 0;
187
+ } catch (e) {
188
+ if (!(e instanceof RangeError)) throw e;
189
+ this._model = void 0;
190
+ }
191
+ }
192
+ _content(e) {
193
+ return typeof e == "string" ? e : e.map((e) => typeof e == "string" ? e : e.tag === "sup" ? i`<sup>${this._content(e.children)}</sup>` : i`<a href=${e.href} title=${c(e.title)} aria-label=${c(e.ariaLabel)}>${this._content(e.children)}</a>`);
194
+ }
195
+ _mobileRows(e) {
196
+ let t = [], n = e.headings.flat().filter((t) => (t.text || t.ariaLabel) && t.column + t.colSpan <= e.stubCount), r = n.map((e) => e.ariaLabel || e.text).join(" "), o = n.filter((e) => !e.visuallyHidden && e.text), s = [], l = [];
197
+ return e.columns.forEach((u, d) => {
198
+ let f = 0;
199
+ for (; f < u.length && u[f] === s[f];) f++;
200
+ l.length = f, u.forEach((e, n) => {
201
+ if (n < f) return;
202
+ let r = `group-${d}-${n}`;
203
+ l.push(r);
204
+ let a = n === 0 ? "outer" : `group${f === 0 ? " first" : ""}`;
205
+ t.push(i`<tr class=${a}><th id=${r} aria-label=${c(e.ariaLabel)} scope="col" colspan="2">${this._content(e.content)}</th></tr>`);
206
+ });
207
+ let p = n.length ? `stub-heading-${d}` : void 0;
208
+ p && (l.push(p), t.push(i`<tr class="stub-headings"><th id=${p} scope="col" colspan="2" aria-label=${c(r)}>${o.map((e, t) => i`${t ? " " : a}<span>${this._content(e.content)}</span>`)}</th></tr>`)), e.rows.forEach((n, r) => {
209
+ let o = `mobile-row-${d}-${r}`;
210
+ t.push(i`<tr class=${r === e.rows.length - 1 ? "last" : ""}>
211
+ <th class="stub" scope="row" id=${o} headers=${c(p)}>${n.stubs.filter((e) => e !== "").map((e, t) => i`${t ? " " : a}${this._content(e)}`)}</th>
212
+ <td headers=${[...l, o].join(" ")}>${this._content(n.values[d])}</td></tr>`);
213
+ }), s = u;
214
+ }), t;
215
+ }
216
+ render() {
217
+ let e = this._model;
218
+ return i`<div class="scroll" tabindex="0" ?hidden=${!!e}><slot @slotchange=${this._queueRead}></slot></div>
219
+ ${e ? i`<table class="mobile" aria-label=${c(e.label || void 0)}>
220
+ <tbody>${this._mobileRows(e)}</tbody>
221
+ </table>` : a}`;
222
+ }
223
+ };
224
+ e([s()], f.prototype, "_model", void 0), e([s()], f.prototype, "_mobile", void 0), f = e([o("scb-table-next")], f);
225
+ //#endregion
226
+ export { f as ScbTableNext };
@@ -93,6 +93,10 @@ var u = 0, d = "data-scb-tooltip-managed-action-size", f = class extends i {
93
93
  }
94
94
 
95
95
  .scb-tooltip-supporting-text {
96
+ box-sizing: border-box;
97
+ min-width: 0;
98
+ max-width: 100%;
99
+ overflow-wrap: anywhere;
96
100
  font-family: var(--scb-tooltip-supporting-font, var(--scb-tooltip-design-supporting-medium-font));
97
101
  font-size: var(--scb-tooltip-supporting-size, var(--scb-tooltip-design-supporting-medium-size));
98
102
  font-style: normal;
@@ -179,8 +183,10 @@ var u = 0, d = "data-scb-tooltip-managed-action-size", f = class extends i {
179
183
  }
180
184
 
181
185
  :host([variant='rich']) .scb-tooltip-text-container {
186
+ box-sizing: border-box;
182
187
  display: flex;
183
- min-width: 220px;
188
+ min-width: 0;
189
+ max-width: 100%;
184
190
  padding: var(--scb-tooltip-design-rich-padding-block-medium) var(--scb-tooltip-design-rich-padding-inline-medium) var(--spacing-2) var(--scb-tooltip-design-rich-padding-inline-medium);
185
191
  align-items: flex-start;
186
192
  gap: var(--spacing-2);
@@ -0,0 +1,27 @@
1
+ import e from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
2
+ import { LitElement as t, css as n, html as r } from "lit";
3
+ import { customElement as i, property as a } from "lit/decorators.js";
4
+ //#region src/scb-components/scb-tour/scb-tour-step.ts
5
+ var o = class extends t {
6
+ constructor(...e) {
7
+ super(...e), this.target = "", this.heading = "";
8
+ }
9
+ static {
10
+ this.styles = n`:host { display: none !important; }`;
11
+ }
12
+ connectedCallback() {
13
+ super.connectedCallback(), this.setAttribute("hidden", ""), this.setAttribute("aria-hidden", "true");
14
+ }
15
+ render() {
16
+ return r`<slot></slot>`;
17
+ }
18
+ };
19
+ e([a({
20
+ type: String,
21
+ reflect: !0
22
+ })], o.prototype, "target", void 0), e([a({
23
+ type: String,
24
+ reflect: !0
25
+ })], o.prototype, "heading", void 0), o = e([i("scb-tour-step")], o);
26
+ //#endregion
27
+ export { o as ScbTourStepElement };
@@ -0,0 +1,368 @@
1
+ import e from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
2
+ import "../scb-button/scb-button.js";
3
+ import "../scb-icon-button/scb-icon-button.js";
4
+ import { closeManualPopover as t, openManualPopover as n } from "../shared/manual-popover.js";
5
+ import { ScbTourStepElement as r } from "./scb-tour-step.js";
6
+ import { LitElement as i, css as a, html as o } from "lit";
7
+ import { customElement as s, property as c, state as l } from "lit/decorators.js";
8
+ //#region src/scb-components/scb-tour/scb-tour.ts
9
+ var u, d = {
10
+ fromAttribute: (e) => e !== null && e !== "false",
11
+ toAttribute: (e) => e ? "" : null
12
+ }, f = class extends i {
13
+ static {
14
+ u = this;
15
+ }
16
+ constructor(...e) {
17
+ super(...e), this.variant = "standard", this.spotlight = !1, this.open = !1, this.autoStart = !1, this.storageKey = "", this.step = 0, this.closeLabel = "Stäng guiden", this.previousLabel = "Föregående", this.nextLabel = "Nästa", this.doneLabel = "Klart", this.stepLabel = "{current} av {total}", this._steps = [], this._stepObserver = new MutationObserver(() => this._readSteps()), this._autoStartAttempted = !1, this._startRequest = 0, this._shownStorageKey = "", this._spotlightId = `scb-tour-spotlight-${u._nextId++}`, this._operation = 0, this._frame = 0, this._scrollRoots = [], this._resizeObserver = new ResizeObserver(() => this._schedulePosition()), this._startOnLoad = async () => {
18
+ if (!this.isConnected || document.readyState !== "complete" || !this.autoStart || this.open || this._autoStartAttempted) return;
19
+ this._autoStartAttempted = !0;
20
+ let e = this._startRequest, t = this.storageKey;
21
+ try {
22
+ if (t && localStorage.getItem(t) === "seen") return;
23
+ } catch {}
24
+ await this.updateComplete;
25
+ let n = this._findTarget(this._steps[0]?.target);
26
+ n?.localName.includes("-") && (await customElements.whenDefined(n.localName), await n.updateComplete), this.isConnected && this.autoStart && !this.open && e === this._startRequest && t === this.storageKey && this.start();
27
+ }, this._schedulePosition = (e) => {
28
+ e && this.shadowRoot?.querySelector(".layer")?.removeAttribute("data-moving"), cancelAnimationFrame(this._frame), this._frame = requestAnimationFrame(() => this._position());
29
+ }, this._onResize = (e) => {
30
+ this._target?.scrollIntoView({
31
+ block: "center",
32
+ inline: "nearest",
33
+ behavior: "instant"
34
+ }), this._schedulePosition(e);
35
+ }, this._next = () => {
36
+ this.step >= this._steps.length - 1 ? this._close("complete") : this.step++;
37
+ }, this._onKeydown = (e) => {
38
+ e.key !== "Escape" || !this.open || e.defaultPrevented || (e.preventDefault(), e.stopPropagation(), this.close());
39
+ };
40
+ }
41
+ static {
42
+ this._nextId = 0;
43
+ }
44
+ static {
45
+ this.styles = a`
46
+ :host { display: block; }
47
+ .layer {
48
+ display: none;
49
+ position: fixed;
50
+ inset: 0;
51
+ margin: 0;
52
+ padding: 0;
53
+ border: 0;
54
+ inline-size: 100%;
55
+ block-size: 100%;
56
+ max-inline-size: none;
57
+ max-block-size: none;
58
+ overflow: visible;
59
+ background: transparent;
60
+ pointer-events: none;
61
+ }
62
+ .layer:popover-open { display: block; }
63
+ .layer::backdrop { background: transparent; pointer-events: none; }
64
+ :host([spotlight]) .layer:popover-open {
65
+ animation: scb-kf-fade-in var(--scb-motion-duration-short, 200ms) var(--scb-motion-easing-standard, ease);
66
+ }
67
+ @keyframes scb-kf-fade-in {
68
+ from { opacity: 0; }
69
+ to { opacity: 1; }
70
+ }
71
+ .spotlight { display: none; position: fixed; inset: 0; inline-size: 100%; block-size: 100%; }
72
+ :host([spotlight]) .spotlight { display: block; }
73
+ .spotlight-hole {
74
+ x: calc(var(--_spotlight-left) - var(--spacing-3, 8px));
75
+ y: calc(var(--_spotlight-top) - var(--spacing-3, 8px));
76
+ width: calc(var(--_spotlight-width) + 2 * var(--spacing-3, 8px));
77
+ height: calc(var(--_spotlight-height) + 2 * var(--spacing-3, 8px));
78
+ rx: var(--radius-medium, 12px);
79
+ }
80
+ .layer[data-moving] .spotlight-hole {
81
+ transition-property: x, y, width, height;
82
+ transition-duration: var(--scb-motion-duration-short, 200ms);
83
+ transition-timing-function: var(--scb-motion-easing-standard, ease);
84
+ }
85
+ .spotlight-scrim {
86
+ fill: var(--scb-tour-spotlight-color, color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent));
87
+ }
88
+ @media (prefers-reduced-motion: reduce) {
89
+ :host([spotlight]) .layer:popover-open { animation: none; }
90
+ .layer[data-moving] .spotlight-hole { transition: none; }
91
+ }
92
+ .surface {
93
+ position: fixed;
94
+ pointer-events: auto;
95
+ box-sizing: border-box;
96
+ margin: 0;
97
+ inset: auto;
98
+ border: 0;
99
+ inline-size: min(360px, calc(100vw - 2 * var(--spacing-4, 12px)));
100
+ max-block-size: min(var(--available-height, 100vh), calc(100vh - 2 * var(--spacing-4, 12px)));
101
+ padding: var(--scb-tour-design-padding-medium);
102
+ border-radius: var(--scb-tour-design-radius-medium);
103
+ background: var(--scb-tour-surface-color, var(--md-sys-color-surface-container));
104
+ color: var(--scb-tour-content-color, var(--md-sys-color-on-surface));
105
+ box-shadow: var(--scb-tour-design-shadow-medium);
106
+ overflow: visible;
107
+ outline: none;
108
+ font-family: var(--scb-tour-design-supporting-medium-font);
109
+ font-size: var(--scb-tour-design-supporting-medium-size);
110
+ line-height: var(--scb-tour-design-supporting-medium-line-height);
111
+ font-weight: var(--scb-tour-design-supporting-medium-weight);
112
+ letter-spacing: var(--scb-tour-design-supporting-medium-tracking);
113
+ }
114
+ :host([variant='inverse']) .surface {
115
+ background: var(--scb-tour-surface-color, var(--md-sys-color-on-info-container));
116
+ color: var(--scb-tour-content-color, var(--md-sys-color-info-container));
117
+ --scb-button-low-emphasis-content-color: var(--scb-tour-content-color, var(--md-sys-color-info-container));
118
+ --scb-button-filled-container-color: var(--scb-tour-content-color, var(--md-sys-color-info-container));
119
+ --scb-button-filled-content-color: var(--scb-tour-surface-color, var(--md-sys-color-on-info-container));
120
+ --scb-button-disabled-content-color: color-mix(in srgb, var(--scb-tour-content-color, var(--md-sys-color-info-container)) calc(100% * var(--md-sys-state-disabled-state-layer-opacity, 0.38)), transparent);
121
+ --md-icon-button-icon-color: var(--scb-tour-content-color, var(--md-sys-color-info-container));
122
+ --md-focus-ring-color: var(--scb-tour-content-color, var(--md-sys-color-info-container));
123
+ }
124
+ .body {
125
+ display: grid;
126
+ gap: var(--scb-tour-design-gap-medium);
127
+ max-block-size: calc(min(var(--available-height, 100vh), 100vh - 2 * var(--spacing-4, 12px)) - 2 * var(--scb-tour-design-padding-medium));
128
+ overflow: auto;
129
+ overflow-wrap: anywhere;
130
+ }
131
+ .header { display: flex; align-items: start; gap: var(--scb-tour-design-gap-medium); }
132
+ h2 {
133
+ flex: 1;
134
+ margin: 0;
135
+ font-family: var(--scb-tour-design-title-medium-font);
136
+ font-size: var(--scb-tour-design-title-medium-size);
137
+ line-height: var(--scb-tour-design-title-medium-line-height);
138
+ font-weight: var(--scb-tour-design-title-medium-weight);
139
+ letter-spacing: var(--scb-tour-design-title-medium-tracking);
140
+ }
141
+ p { margin: 0; }
142
+ .footer { display: flex; align-items: center; flex-wrap: wrap; gap: var(--scb-tour-design-gap-medium); }
143
+ .counter { margin-inline-end: auto; }
144
+ .actions { display: flex; flex-wrap: wrap; gap: var(--scb-tour-design-gap-medium); }
145
+ .arrow {
146
+ position: absolute;
147
+ left: clamp(var(--scb-tour-design-arrow-size-medium), calc(var(--anchor-x) - var(--scb-tour-design-arrow-size-medium)), calc(100% - 3 * var(--scb-tour-design-arrow-size-medium)));
148
+ top: calc(-1 * var(--scb-tour-design-arrow-size-medium));
149
+ inline-size: calc(2 * var(--scb-tour-design-arrow-size-medium));
150
+ block-size: var(--scb-tour-design-arrow-size-medium);
151
+ background: inherit;
152
+ clip-path: polygon(50% 0, 100% 100%, 0 100%);
153
+ pointer-events: none;
154
+ }
155
+ .surface[data-side='top'] { translate: 0 -100%; }
156
+ .surface[data-side='top'] .arrow { top: 100%; transform: rotate(180deg); }
157
+
158
+ /* design:bindings:scb-tour:start */
159
+ /* Genererat från src/scb-components/scb-tour/component.json. Kör component:finish efter ändring. */
160
+ :host {
161
+ --scb-tour-design-padding-medium: var(--spacing-5, 16px);
162
+ --scb-tour-design-gap-medium: var(--spacing-4, 12px);
163
+ --scb-tour-design-radius-medium: var(--radius-medium, 12px);
164
+ --scb-tour-design-anchor-gap-medium: var(--spacing-4, 12px);
165
+ --scb-tour-design-arrow-size-medium: var(--spacing-3, 8px);
166
+ --scb-tour-design-title-medium-font: var(--scb-typography-title-medium-font, var(--md-sys-typescale-title-medium-font, var(--brand)));
167
+ --scb-tour-design-title-medium-size: var(--scb-typography-title-medium-size, var(--md-sys-typescale-title-medium-size, 18px));
168
+ --scb-tour-design-title-medium-line-height: var(--scb-typography-title-medium-line-height, var(--md-sys-typescale-title-medium-line-height, 26px));
169
+ --scb-tour-design-title-medium-tracking: var(--scb-typography-title-medium-tracking, var(--md-sys-typescale-title-medium-tracking, var(--tracking-05, -0.3px)));
170
+ --scb-tour-design-title-medium-weight: var(--scb-typography-title-medium-weight, var(--md-sys-typescale-title-medium-weight, var(--weight-semibold, 600)));
171
+ --scb-tour-design-title-medium-letter-spacing: var(--scb-typography-title-medium-letter-spacing, var(--scb-typography-title-medium-tracking, var(--md-sys-typescale-title-medium-tracking, var(--tracking-05, -0.3px))));
172
+ --scb-tour-design-title-medium-font-weight: var(--scb-typography-title-medium-font-weight, var(--scb-typography-title-medium-weight, var(--md-sys-typescale-title-medium-weight, var(--weight-semibold, 600))));
173
+ --scb-tour-design-supporting-medium-font: var(--scb-typography-body-medium-font, var(--md-sys-typescale-body-medium-font, var(--brand)));
174
+ --scb-tour-design-supporting-medium-size: var(--scb-typography-body-medium-size, var(--md-sys-typescale-body-medium-size, 16px));
175
+ --scb-tour-design-supporting-medium-line-height: var(--scb-typography-body-medium-line-height, var(--md-sys-typescale-body-medium-line-height, 24px));
176
+ --scb-tour-design-supporting-medium-tracking: var(--scb-typography-body-medium-tracking, var(--md-sys-typescale-body-medium-tracking, var(--tracking-03, -0.15px)));
177
+ --scb-tour-design-supporting-medium-weight: var(--scb-typography-body-medium-weight, var(--md-sys-typescale-body-medium-weight, var(--weight-regular, 400)));
178
+ --scb-tour-design-supporting-medium-letter-spacing: var(--scb-typography-body-medium-letter-spacing, var(--scb-typography-body-medium-tracking, var(--md-sys-typescale-body-medium-tracking, var(--tracking-03, -0.15px))));
179
+ --scb-tour-design-supporting-medium-font-weight: var(--scb-typography-body-medium-font-weight, var(--scb-typography-body-medium-weight, var(--md-sys-typescale-body-medium-weight, var(--weight-regular, 400))));
180
+ }
181
+
182
+ /* design:bindings:scb-tour:end */
183
+ `;
184
+ }
185
+ connectedCallback() {
186
+ super.connectedCallback(), this._readSteps(), this._stepObserver.observe(this, {
187
+ childList: !0,
188
+ subtree: !0,
189
+ characterData: !0,
190
+ attributes: !0,
191
+ attributeFilter: ["target", "heading"]
192
+ }), document.readyState !== "complete" && window.addEventListener("load", this._startOnLoad, { once: !0 });
193
+ }
194
+ disconnectedCallback() {
195
+ this._startRequest++, this._stepObserver.disconnect(), window.removeEventListener("load", this._startOnLoad), this._hide(), super.disconnectedCallback();
196
+ }
197
+ updated(e) {
198
+ this.open && e.has("open") && (this._autoStartAttempted = !0, this._startRequest++), this.open ? e.has("open") || e.has("step") || e.has("_steps") ? this._showStep() : e.has("spotlight") && this._position() : this._hide(), this._startOnLoad();
199
+ }
200
+ _readSteps() {
201
+ this._steps = Array.from(this.children).filter((e) => e instanceof r).map((e) => ({
202
+ target: e.target,
203
+ heading: e.heading,
204
+ content: (e.textContent ?? "").replace(/\s+/g, " ").trim()
205
+ }));
206
+ }
207
+ _findTarget(e) {
208
+ if (!e) return null;
209
+ try {
210
+ let t = this.querySelector(e) ?? this.getRootNode().querySelector(e);
211
+ return t instanceof HTMLElement ? t : null;
212
+ } catch {
213
+ return null;
214
+ }
215
+ }
216
+ start() {
217
+ this._autoStartAttempted = !0, this._startRequest++, this.step = 0, this.open = !0;
218
+ }
219
+ close() {
220
+ this._autoStartAttempted = !0, this._startRequest++, this._close("dismiss");
221
+ }
222
+ _close(e) {
223
+ if (this.open) {
224
+ if (this._shownStorageKey && e !== "target-unavailable") try {
225
+ localStorage.setItem(this._shownStorageKey, "seen");
226
+ } catch {}
227
+ this.open = !1, this._hide(), this.dispatchEvent(new CustomEvent("close", {
228
+ detail: {
229
+ reason: e,
230
+ step: this.step
231
+ },
232
+ bubbles: !0,
233
+ composed: !0
234
+ }));
235
+ }
236
+ }
237
+ _hide() {
238
+ this._operation++, cancelAnimationFrame(this._frame), this._resizeObserver.disconnect(), window.removeEventListener("resize", this._onResize), window.removeEventListener("keydown", this._onKeydown), window.removeEventListener("scroll", this._schedulePosition, !0), this._scrollRoots.forEach((e) => e.removeEventListener("scroll", this._schedulePosition, !0)), this._scrollRoots = [];
239
+ let e = (this.shadowRoot?.querySelector(".surface"))?.contains(this.shadowRoot?.activeElement ?? null), n = this.shadowRoot?.querySelector(".layer");
240
+ t(n), n?.removeAttribute("data-moving"), e && this._returnFocus?.isConnected && this._returnFocus.focus({ preventScroll: !0 }), this._returnFocus = void 0, this._target = void 0, this._spotlightTarget = void 0, this._shownStorageKey = "";
241
+ }
242
+ async _showStep() {
243
+ let e = ++this._operation;
244
+ if (await this.updateComplete, !this.open || e !== this._operation) return;
245
+ let t = Math.max(0, Math.min(this._steps.length - 1, Math.trunc(this.step) || 0));
246
+ if (this.step !== t) {
247
+ this.step = t;
248
+ return;
249
+ }
250
+ let r = this._steps[t], i = this._findTarget(r?.target);
251
+ if (!i || !this._isVisible(i)) {
252
+ this._close("target-unavailable");
253
+ return;
254
+ }
255
+ let a = this.shadowRoot.querySelector(".surface"), o = this.shadowRoot.querySelector(".layer");
256
+ if (!o.matches(":popover-open")) {
257
+ this._shownStorageKey = this.storageKey;
258
+ let e = document.activeElement;
259
+ for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
260
+ e instanceof HTMLElement && (this._returnFocus = e);
261
+ }
262
+ this._target = i;
263
+ let s = i.getBoundingClientRect();
264
+ if ((s.top < 0 || s.bottom > innerHeight || s.left < 0 || s.right > innerWidth) && i.scrollIntoView({
265
+ block: "center",
266
+ inline: "nearest",
267
+ behavior: "instant"
268
+ }), !n(o, i)) {
269
+ this._close("target-unavailable");
270
+ return;
271
+ }
272
+ this._resizeObserver.disconnect(), this._resizeObserver.observe(i), this._resizeObserver.observe(a), window.addEventListener("resize", this._onResize), window.addEventListener("scroll", this._schedulePosition, !0), this._scrollRoots.forEach((e) => e.removeEventListener("scroll", this._schedulePosition, !0)), this._scrollRoots = [];
273
+ let c = i.getRootNode();
274
+ for (; c instanceof ShadowRoot;) c.addEventListener("scroll", this._schedulePosition, !0), this._scrollRoots.push(c), c = c.host.getRootNode();
275
+ this._position(), a.focus({ preventScroll: !0 }), this.dispatchEvent(new CustomEvent("stepchange", {
276
+ detail: {
277
+ step: t,
278
+ total: this._steps.length
279
+ },
280
+ bubbles: !0,
281
+ composed: !0
282
+ }));
283
+ }
284
+ _isVisible(e) {
285
+ let t = getComputedStyle(e), n = e.getBoundingClientRect();
286
+ return e.isConnected && t.visibility !== "hidden" && n.width > 0 && n.height > 0;
287
+ }
288
+ _position() {
289
+ let e = this._target, t = this.shadowRoot?.querySelector(".surface");
290
+ if (!this.open || !t || !e) return;
291
+ if (!this._isVisible(e)) {
292
+ this._close("target-unavailable");
293
+ return;
294
+ }
295
+ let n = getComputedStyle(this), r = Number.parseFloat(n.getPropertyValue("--spacing-4")) || 12, i = Number.parseFloat(n.getPropertyValue("--scb-tour-design-anchor-gap-medium")) || 12, a = e.getBoundingClientRect();
296
+ if (this.spotlight) {
297
+ window.addEventListener("keydown", this._onKeydown);
298
+ let t = this.shadowRoot.querySelector(".layer");
299
+ this._spotlightTarget !== e && (t.toggleAttribute("data-moving", !!this._spotlightTarget), this._spotlightTarget = e), t.style.setProperty("--_spotlight-left", `${a.left}px`), t.style.setProperty("--_spotlight-top", `${a.top}px`), t.style.setProperty("--_spotlight-width", `${a.width}px`), t.style.setProperty("--_spotlight-height", `${a.height}px`);
300
+ } else window.removeEventListener("keydown", this._onKeydown), this._spotlightTarget = void 0;
301
+ let o = t.getBoundingClientRect(), s = innerHeight - a.bottom - i, c = a.top - i, l = s >= o.height + r || s >= c ? "bottom" : "top";
302
+ t.style.setProperty("--available-height", `calc(${Math.max(0, (l === "bottom" ? innerHeight - a.bottom : a.top) - r)}px - var(--scb-tour-design-anchor-gap-medium))`);
303
+ let u = Math.max(r, Math.min(a.left + a.width / 2 - o.width / 2, innerWidth - o.width - r));
304
+ t.style.left = `${u}px`, t.style.top = l === "bottom" ? `calc(${a.bottom}px + var(--scb-tour-design-anchor-gap-medium))` : `calc(${a.top}px - var(--scb-tour-design-anchor-gap-medium))`, t.dataset.side = l, t.style.setProperty("--anchor-x", `${a.left + a.width / 2 - u}px`);
305
+ }
306
+ render() {
307
+ let e = this._steps[this.step], t = this.stepLabel.replace("{current}", String(this.step + 1)).replace("{total}", String(this._steps.length));
308
+ return o`
309
+ <slot name="trigger" @click=${(e) => {
310
+ e.defaultPrevented || this.start();
311
+ }}></slot>
312
+ <slot></slot>
313
+ <div class="layer" popover="manual">
314
+ <svg class="spotlight" aria-hidden="true" focusable="false">
315
+ <defs>
316
+ <mask id=${this._spotlightId} maskUnits="userSpaceOnUse" x="0" y="0" width="100%" height="100%">
317
+ <rect width="100%" height="100%" fill="white"></rect>
318
+ <rect class="spotlight-hole" fill="black"></rect>
319
+ </mask>
320
+ </defs>
321
+ <rect class="spotlight-scrim" width="100%" height="100%" mask=${`url(#${this._spotlightId})`}></rect>
322
+ </svg>
323
+ <section class="surface" part="surface" role="dialog" tabindex="-1"
324
+ aria-labelledby="heading" aria-describedby="content counter" @keydown=${this._onKeydown}>
325
+ <span class="arrow" part="arrow" aria-hidden="true"></span>
326
+ <div class="body">
327
+ <div class="header">
328
+ <h2 id="heading">${e?.heading}</h2>
329
+ <scb-icon-button size="small" icon="close" aria-label=${this.closeLabel} @click=${this.close}></scb-icon-button>
330
+ </div>
331
+ <p id="content">${e?.content}</p>
332
+ <div class="footer">
333
+ <span id="counter" class="counter">${t}</span>
334
+ <div class="actions">
335
+ <scb-button variant="text" size="small" .label=${this.previousLabel} ?disabled=${this.step <= 0} @click=${() => this.step--}></scb-button>
336
+ <scb-button size="small" .label=${this.step === this._steps.length - 1 ? this.doneLabel : this.nextLabel} @click=${this._next}></scb-button>
337
+ </div>
338
+ </div>
339
+ </div>
340
+ </section>
341
+ </div>
342
+ `;
343
+ }
344
+ };
345
+ e([c({
346
+ type: String,
347
+ reflect: !0
348
+ })], f.prototype, "variant", void 0), e([c({
349
+ type: Boolean,
350
+ reflect: !0,
351
+ converter: d
352
+ })], f.prototype, "spotlight", void 0), e([c({
353
+ type: Boolean,
354
+ reflect: !0,
355
+ converter: d
356
+ })], f.prototype, "open", void 0), e([c({
357
+ type: Boolean,
358
+ attribute: "auto-start",
359
+ converter: d
360
+ })], f.prototype, "autoStart", void 0), e([c({
361
+ type: String,
362
+ attribute: "storage-key"
363
+ })], f.prototype, "storageKey", void 0), e([c({
364
+ type: Number,
365
+ reflect: !0
366
+ })], f.prototype, "step", void 0), e([c({ attribute: "close-label" })], f.prototype, "closeLabel", void 0), e([c({ attribute: "previous-label" })], f.prototype, "previousLabel", void 0), e([c({ attribute: "next-label" })], f.prototype, "nextLabel", void 0), e([c({ attribute: "done-label" })], f.prototype, "doneLabel", void 0), e([c({ attribute: "step-label" })], f.prototype, "stepLabel", void 0), e([l()], f.prototype, "_steps", void 0), f = u = e([s("scb-tour")], f);
367
+ //#endregion
368
+ export { f as ScbTour };