scb-wc 0.1.262 → 0.1.263

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 (85) hide show
  1. package/README.md +16 -19
  2. package/all.d.ts +0 -16
  3. package/all.js +0 -16
  4. package/index.js +85 -101
  5. package/mvc/components/all.js +0 -11
  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/components/scb-cookies-consent/scb-cookies-consent.js +1 -1
  15. package/mvc/components/scb-dialog/scb-dialog.js +1 -1
  16. package/mvc/components/scb-drawer/scb-drawer.js +3 -3
  17. package/mvc/components/scb-drop-zone/scb-drop-zone.js +1 -1
  18. package/mvc/components/scb-dropdown/scb-dropdown.js +1 -1
  19. package/mvc/components/scb-fact-card/scb-fact-card.js +1 -1
  20. package/mvc/components/scb-header/scb-header.js +2 -2
  21. package/mvc/components/scb-horizontal-scroller/scb-horizontal-scroller.js +6 -6
  22. package/mvc/components/scb-icon-button/scb-icon-button.js +5 -5
  23. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +6 -6
  24. package/mvc/components/scb-link/scb-link.js +1 -1
  25. package/mvc/components/scb-link-button/scb-link-button.js +1 -1
  26. package/mvc/components/scb-list/scb-list-item.js +6 -6
  27. package/mvc/components/scb-menu/scb-menu-item.js +1 -1
  28. package/mvc/components/scb-nav/scb-nav.js +1 -1
  29. package/mvc/components/scb-notification-card/scb-notification-card.js +1 -1
  30. package/mvc/components/scb-options-menu/scb-options-menu-item.js +1 -1
  31. package/mvc/components/scb-options-menu/scb-options-menu.js +2 -2
  32. package/mvc/components/scb-options-menu/scb-options-sub-menu.js +1 -1
  33. package/mvc/components/scb-overlay/scb-overlay.js +3 -3
  34. package/mvc/components/scb-pagination/scb-pagination.js +1 -1
  35. package/mvc/components/scb-progress-stepper/scb-progress-step.js +1 -1
  36. package/mvc/components/scb-search/scb-search.js +3 -3
  37. package/mvc/components/scb-segmented-button/scb-segmented-item.js +1 -1
  38. package/mvc/components/scb-select/scb-select-option.js +1 -1
  39. package/mvc/components/scb-select/scb-select.js +1 -1
  40. package/mvc/components/scb-snackbar/scb-snackbar.js +1 -1
  41. package/mvc/components/scb-stepper/scb-step.js +1 -1
  42. package/mvc/components/scb-table/scb-table.js +1 -1
  43. package/mvc/components/scb-table-advanced/scb-table-advanced.js +1 -1
  44. package/mvc/components/scb-textfield/scb-textfield.js +176 -34
  45. package/mvc/components/scb-toc/scb-toc-item.js +1 -1
  46. package/mvc/components/scb-tooltip/scb-tooltip.js +1 -1
  47. package/mvc/{components/shared → vendor}/component-size-token.js +1 -1
  48. package/mvc/vendor/lazy-focus-ring.js +2 -0
  49. package/mvc/vendor/lazy-ripple.js +2 -0
  50. package/mvc/{components/shared → vendor}/manual-popover.js +1 -1
  51. package/mvc/{components/scb-chevron → vendor}/scb-chevron.js +1 -1
  52. package/mvc/vendor/scb-icon-svg.js +11 -0
  53. package/package.json +2 -22
  54. package/scb-viz/scb-viz-series-differentiation-registry.js +7 -10
  55. package/scb-viz/scb-viz.js +43 -43
  56. package/scb-wc.bundle.js +290 -581
  57. package/scb-wc.d.ts +0 -32
  58. package/shared/scb-icon-svg.js +2 -5
  59. package/mvc/components/scb-datepicker/scb-datepicker.js +0 -143
  60. package/mvc/components/scb-table-next/read-table.js +0 -1
  61. package/mvc/components/scb-table-next/scb-table-next.js +0 -6
  62. package/mvc/components/scb-tour/scb-tour-step.js +0 -1
  63. package/mvc/components/scb-tour/scb-tour.js +0 -33
  64. package/mvc/components/shared/lazy-focus-ring.js +0 -2
  65. package/mvc/components/shared/lazy-ripple.js +0 -2
  66. package/mvc/components/shared/scb-icon-svg.js +0 -11
  67. package/scb-components/index.d.ts +0 -110
  68. package/scb-components/scb-table-next/read-table.d.ts +0 -29
  69. package/scb-components/scb-table-next/scb-table-next.d.ts +0 -22
  70. package/scb-components/scb-tour/scb-tour-step.d.ts +0 -13
  71. package/scb-components/scb-tour/scb-tour.d.ts +0 -57
  72. package/scb-components/scb-viz/scb-viz-actions-runtime.d.ts +0 -26
  73. package/scb-components/scb-viz/scb-viz-print-runtime.d.ts +0 -36
  74. package/scb-components/scb-viz/scb-viz-series-differentiation-registry.d.ts +0 -21
  75. package/scb-components/scb-viz/scb-viz-series-differentiation-runtime.d.ts +0 -42
  76. package/scb-components/scb-viz/scb-viz-table-runtime.d.ts +0 -31
  77. package/scb-components/shared/component-size-token.d.ts +0 -1
  78. package/scb-components/shared/lazy-focus-ring.d.ts +0 -4
  79. package/scb-components/shared/lazy-ripple.d.ts +0 -9
  80. package/scb-components/shared/manual-popover.d.ts +0 -7
  81. package/scb-components/shared/scb-icon-svg.d.ts +0 -3
  82. package/scb-table-next/read-table.js +0 -87
  83. package/scb-table-next/scb-table-next.js +0 -226
  84. package/scb-tour/scb-tour-step.js +0 -27
  85. package/scb-tour/scb-tour.js +0 -368
@@ -1,368 +0,0 @@
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 };