scb-wc-test 0.1.1

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 (178) hide show
  1. package/README.md +130 -0
  2. package/all.js +54 -0
  3. package/dummy.png +0 -0
  4. package/index.d.ts +54 -0
  5. package/index.js +108 -0
  6. package/mvc/components/all.js +53 -0
  7. package/mvc/components/scb-accordion/scb-accordion-item.js +194 -0
  8. package/mvc/components/scb-accordion/scb-accordion.js +5 -0
  9. package/mvc/components/scb-app-bar/scb-app-bar.js +144 -0
  10. package/mvc/components/scb-avatar/scb-avatar.js +99 -0
  11. package/mvc/components/scb-breadcrumb/scb-breadcrumb-item.js +17 -0
  12. package/mvc/components/scb-breadcrumb/scb-breadcrumb.js +52 -0
  13. package/mvc/components/scb-button/scb-button.js +121 -0
  14. package/mvc/components/scb-calendar-card/scb-calendar-card.js +140 -0
  15. package/mvc/components/scb-card/scb-card.js +256 -0
  16. package/mvc/components/scb-checkbox/scb-checkbox-group.js +33 -0
  17. package/mvc/components/scb-checkbox/scb-checkbox.js +99 -0
  18. package/mvc/components/scb-chips/scb-chip.js +46 -0
  19. package/mvc/components/scb-dialog/scb-dialog.js +158 -0
  20. package/mvc/components/scb-divider/scb-divider.js +53 -0
  21. package/mvc/components/scb-drawer/scb-drawer-item.js +114 -0
  22. package/mvc/components/scb-drawer/scb-drawer-section.js +19 -0
  23. package/mvc/components/scb-drawer/scb-drawer.js +79 -0
  24. package/mvc/components/scb-drawer/scb-sub-drawer.js +10 -0
  25. package/mvc/components/scb-fact-card/scb-fact-card-content.js +44 -0
  26. package/mvc/components/scb-fact-card/scb-fact-card.js +66 -0
  27. package/mvc/components/scb-footer/scb-footer-section.js +3 -0
  28. package/mvc/components/scb-footer/scb-footer.js +205 -0
  29. package/mvc/components/scb-grid/scb-grid-item.js +9 -0
  30. package/mvc/components/scb-grid/scb-grid.js +81 -0
  31. package/mvc/components/scb-grid/scb-stack.js +16 -0
  32. package/mvc/components/scb-header/scb-header-drawer-group.js +1 -0
  33. package/mvc/components/scb-header/scb-header-drawer-item.js +1 -0
  34. package/mvc/components/scb-header/scb-header-tab.js +1 -0
  35. package/mvc/components/scb-header/scb-header-utility.js +1 -0
  36. package/mvc/components/scb-header/scb-header.js +240 -0
  37. package/mvc/components/scb-icon-button/scb-icon-button.js +95 -0
  38. package/mvc/components/scb-keyfigure-card/scb-keyfigure-card.js +69 -0
  39. package/mvc/components/scb-link/scb-link.js +31 -0
  40. package/mvc/components/scb-list/scb-list-item.js +38 -0
  41. package/mvc/components/scb-list/scb-list.js +10 -0
  42. package/mvc/components/scb-menu/scb-menu-item.js +44 -0
  43. package/mvc/components/scb-menu/scb-menu.js +17 -0
  44. package/mvc/components/scb-menu/scb-sub-menu.js +29 -0
  45. package/mvc/components/scb-notification/scb-notification.js +120 -0
  46. package/mvc/components/scb-progress-indicator/scb-progress-indicator.js +84 -0
  47. package/mvc/components/scb-radio-button/scb-radio-button.js +95 -0
  48. package/mvc/components/scb-radio-button/scb-radio-group.js +28 -0
  49. package/mvc/components/scb-search/scb-search.js +211 -0
  50. package/mvc/components/scb-snackbar/scb-snackbar.js +83 -0
  51. package/mvc/components/scb-status-pill/scb-status-pill.js +31 -0
  52. package/mvc/components/scb-switch/scb-switch.js +54 -0
  53. package/mvc/components/scb-tabs/scb-primary-tab.js +7 -0
  54. package/mvc/components/scb-tabs/scb-secondary-tab.js +7 -0
  55. package/mvc/components/scb-tabs/scb-tabs.js +23 -0
  56. package/mvc/components/scb-textfield/scb-textfield.js +135 -0
  57. package/mvc/components/scb-toc/scb-toc-item.js +84 -0
  58. package/mvc/components/scb-toc/scb-toc.js +6 -0
  59. package/mvc/components/scb-tooltip/scb-tooltip.js +216 -0
  60. package/mvc/scb-logo.svg +21 -0
  61. package/mvc/scb-wc-test.css +1 -0
  62. package/mvc/scb.svg +14 -0
  63. package/mvc/vendor/preload-helper.js +1 -0
  64. package/mvc/vendor/vendor-lit.js +1 -0
  65. package/mvc/vendor/vendor-material.js +764 -0
  66. package/mvc/vendor/vendor.js +68 -0
  67. package/package.json +248 -0
  68. package/scb-accordion/scb-accordion-item.d.ts +37 -0
  69. package/scb-accordion/scb-accordion-item.js +343 -0
  70. package/scb-accordion/scb-accordion.d.ts +6 -0
  71. package/scb-accordion/scb-accordion.js +33 -0
  72. package/scb-app-bar/scb-app-bar.d.ts +10 -0
  73. package/scb-app-bar/scb-app-bar.js +192 -0
  74. package/scb-avatar/scb-avatar.d.ts +30 -0
  75. package/scb-avatar/scb-avatar.js +169 -0
  76. package/scb-breadcrumb/scb-breadcrumb-item.d.ts +9 -0
  77. package/scb-breadcrumb/scb-breadcrumb-item.js +54 -0
  78. package/scb-breadcrumb/scb-breadcrumb.d.ts +16 -0
  79. package/scb-breadcrumb/scb-breadcrumb.js +105 -0
  80. package/scb-button/scb-button.d.ts +26 -0
  81. package/scb-button/scb-button.js +247 -0
  82. package/scb-calendar-card/scb-calendar-card.d.ts +20 -0
  83. package/scb-calendar-card/scb-calendar-card.js +191 -0
  84. package/scb-card/scb-card.d.ts +24 -0
  85. package/scb-card/scb-card.js +345 -0
  86. package/scb-checkbox/scb-checkbox-group.d.ts +17 -0
  87. package/scb-checkbox/scb-checkbox-group.js +80 -0
  88. package/scb-checkbox/scb-checkbox.d.ts +20 -0
  89. package/scb-checkbox/scb-checkbox.js +157 -0
  90. package/scb-chips/scb-chip.d.ts +24 -0
  91. package/scb-chips/scb-chip.js +150 -0
  92. package/scb-dialog/scb-dialog.d.ts +58 -0
  93. package/scb-dialog/scb-dialog.js +390 -0
  94. package/scb-divider/scb-divider.d.ts +9 -0
  95. package/scb-divider/scb-divider.js +85 -0
  96. package/scb-drawer/scb-drawer-item.d.ts +61 -0
  97. package/scb-drawer/scb-drawer-item.js +220 -0
  98. package/scb-drawer/scb-drawer-section.d.ts +7 -0
  99. package/scb-drawer/scb-drawer-section.js +44 -0
  100. package/scb-drawer/scb-drawer.d.ts +97 -0
  101. package/scb-drawer/scb-drawer.js +258 -0
  102. package/scb-drawer/scb-sub-drawer.d.ts +10 -0
  103. package/scb-drawer/scb-sub-drawer.js +43 -0
  104. package/scb-fact-card/scb-fact-card-content.d.ts +10 -0
  105. package/scb-fact-card/scb-fact-card-content.js +83 -0
  106. package/scb-fact-card/scb-fact-card.d.ts +15 -0
  107. package/scb-fact-card/scb-fact-card.js +110 -0
  108. package/scb-footer/scb-footer-section.d.ts +21 -0
  109. package/scb-footer/scb-footer-section.js +28 -0
  110. package/scb-footer/scb-footer.d.ts +27 -0
  111. package/scb-footer/scb-footer.js +326 -0
  112. package/scb-grid/scb-grid-item.d.ts +28 -0
  113. package/scb-grid/scb-grid-item.js +66 -0
  114. package/scb-grid/scb-grid.d.ts +33 -0
  115. package/scb-grid/scb-grid.js +152 -0
  116. package/scb-grid/scb-stack.d.ts +29 -0
  117. package/scb-grid/scb-stack.js +82 -0
  118. package/scb-header/scb-header-drawer-group.d.ts +13 -0
  119. package/scb-header/scb-header-drawer-group.js +28 -0
  120. package/scb-header/scb-header-drawer-item.d.ts +14 -0
  121. package/scb-header/scb-header-drawer-item.js +31 -0
  122. package/scb-header/scb-header-tab.d.ts +13 -0
  123. package/scb-header/scb-header-tab.js +28 -0
  124. package/scb-header/scb-header-utility.d.ts +14 -0
  125. package/scb-header/scb-header-utility.js +31 -0
  126. package/scb-header/scb-header.d.ts +105 -0
  127. package/scb-header/scb-header.js +618 -0
  128. package/scb-icon-button/scb-icon-button.d.ts +31 -0
  129. package/scb-icon-button/scb-icon-button.js +208 -0
  130. package/scb-keyfigure-card/scb-keyfigure-card.d.ts +13 -0
  131. package/scb-keyfigure-card/scb-keyfigure-card.js +119 -0
  132. package/scb-link/scb-link.d.ts +17 -0
  133. package/scb-link/scb-link.js +74 -0
  134. package/scb-list/scb-list-item.d.ts +32 -0
  135. package/scb-list/scb-list-item.js +144 -0
  136. package/scb-list/scb-list.d.ts +8 -0
  137. package/scb-list/scb-list.js +39 -0
  138. package/scb-logo.svg +21 -0
  139. package/scb-menu/scb-menu-item.d.ts +22 -0
  140. package/scb-menu/scb-menu-item.js +107 -0
  141. package/scb-menu/scb-menu.d.ts +21 -0
  142. package/scb-menu/scb-menu.js +98 -0
  143. package/scb-menu/scb-sub-menu.d.ts +12 -0
  144. package/scb-menu/scb-sub-menu.js +69 -0
  145. package/scb-notification/scb-notification.d.ts +16 -0
  146. package/scb-notification/scb-notification.js +187 -0
  147. package/scb-progress-indicator/scb-progress-indicator.d.ts +11 -0
  148. package/scb-progress-indicator/scb-progress-indicator.js +122 -0
  149. package/scb-radio-button/scb-radio-button.d.ts +19 -0
  150. package/scb-radio-button/scb-radio-button.js +176 -0
  151. package/scb-radio-button/scb-radio-group.d.ts +20 -0
  152. package/scb-radio-button/scb-radio-group.js +81 -0
  153. package/scb-search/scb-search.d.ts +45 -0
  154. package/scb-search/scb-search.js +410 -0
  155. package/scb-snackbar/scb-snackbar.d.ts +17 -0
  156. package/scb-snackbar/scb-snackbar.js +140 -0
  157. package/scb-status-pill/scb-status-pill.d.ts +9 -0
  158. package/scb-status-pill/scb-status-pill.js +62 -0
  159. package/scb-switch/scb-switch.d.ts +21 -0
  160. package/scb-switch/scb-switch.js +111 -0
  161. package/scb-tabs/scb-primary-tab.d.ts +17 -0
  162. package/scb-tabs/scb-primary-tab.js +93 -0
  163. package/scb-tabs/scb-secondary-tab.d.ts +17 -0
  164. package/scb-tabs/scb-secondary-tab.js +97 -0
  165. package/scb-tabs/scb-tabs.d.ts +10 -0
  166. package/scb-tabs/scb-tabs.js +66 -0
  167. package/scb-textfield/scb-textfield.d.ts +41 -0
  168. package/scb-textfield/scb-textfield.js +258 -0
  169. package/scb-toc/scb-toc-item.d.ts +21 -0
  170. package/scb-toc/scb-toc-item.js +196 -0
  171. package/scb-toc/scb-toc.d.ts +6 -0
  172. package/scb-toc/scb-toc.js +27 -0
  173. package/scb-tooltip/scb-tooltip.d.ts +32 -0
  174. package/scb-tooltip/scb-tooltip.js +329 -0
  175. package/scb-wc-test.bundle.js +5429 -0
  176. package/scb-wc-test.css +1 -0
  177. package/scb-wc-test.d.ts +106 -0
  178. package/scb.svg +14 -0
@@ -0,0 +1,410 @@
1
+ import { css as y, LitElement as x, nothing as b, html as d } from "lit";
2
+ import { property as h, customElement as A } from "lit/decorators.js";
3
+ import "../scb-list/scb-list.js";
4
+ import "@material/web/ripple/ripple.js";
5
+ import "@material/web/icon/icon.js";
6
+ var w = Object.defineProperty, I = Object.getOwnPropertyDescriptor, l = (e, t, i, n) => {
7
+ for (var s = n > 1 ? void 0 : n ? I(t, i) : t, r = e.length - 1, a; r >= 0; r--)
8
+ (a = e[r]) && (s = (n ? a(t, i, s) : a(s)) || s);
9
+ return n && s && w(t, i, s), s;
10
+ };
11
+ let S = 0, o = class extends x {
12
+ constructor() {
13
+ super(...arguments), this.supportingText = "Hinted search text", this.value = "", this.size = "default", this.fullScreen = !1, this._inputFocused = !1, this._visibleSuggestions = 0, this._activeIndex = -1, this._listboxId = `scb-search-listbox-${++S}`, this._kbMode = !1;
14
+ }
15
+ connectedCallback() {
16
+ super.connectedCallback();
17
+ }
18
+ disconnectedCallback() {
19
+ const e = this._inputEl();
20
+ e && this._boundNativeKeydown && e.removeEventListener("keydown", this._boundNativeKeydown, !0), super.disconnectedCallback();
21
+ }
22
+ firstUpdated() {
23
+ this._ensureListboxA11y(), this._updateComboboxA11y();
24
+ const e = this._inputEl();
25
+ e && (this._boundNativeKeydown = (t) => this._handleKey(t), e.addEventListener("keydown", this._boundNativeKeydown, !0));
26
+ }
27
+ updated() {
28
+ this._ensureListboxA11y(), this._updateComboboxA11y();
29
+ }
30
+ render() {
31
+ const e = (this.value ?? "").trim().length > 0, t = this._inputFocused && e && this._hasSuggestions;
32
+ return d`
33
+ <div class="ripple-wrapper">
34
+ <md-icon class="leading">${e ? "arrow_back" : "search"}</md-icon>
35
+
36
+ <input
37
+ id="searchInput"
38
+ type="search"
39
+ name="textfield"
40
+ class=${t ? "with-list" : ""}
41
+ .value=${this.value}
42
+ placeholder=${this.supportingText}
43
+ autocomplete="off"
44
+ @input=${this._onInput}
45
+ @focus=${this._onFocus}
46
+ @blur=${this._onBlur}
47
+ aria-label=${this.supportingText || "Sök"}
48
+ />
49
+
50
+ ${e ? d`<button class="clear-btn" @click=${this._clearInput} tabindex="-1" aria-label="Rensa sökfält">
51
+ <md-icon>close</md-icon>
52
+ </button>` : this.trailingIcon ? d`<span class="trailing"><md-icon>${this.trailingIcon}</md-icon></span>` : b}
53
+
54
+ <md-ripple></md-ripple>
55
+ </div>
56
+
57
+ <div class="list-divider" aria-hidden=${String(!(this.fullScreen && t))}></div>
58
+
59
+ ${t ? d`<scb-list class="suggestion-list" id=${this._listboxId}>
60
+ <slot @slotchange=${this._onSlotChange}></slot>
61
+ </scb-list>` : b}
62
+ `;
63
+ }
64
+ submit() {
65
+ const e = this._getActiveItem(), t = { value: this.value };
66
+ e && (t.active = this._itemPayload(e)), this.dispatchEvent(new CustomEvent("scb-search-submit", {
67
+ detail: t,
68
+ bubbles: !0,
69
+ composed: !0
70
+ }));
71
+ }
72
+ get _hasSuggestions() {
73
+ return this._visibleSuggestions >= 0 ? this._visibleSuggestions > 0 : Array.from(this.getElementsByTagName("scb-list-item")).some((t) => !t.hasAttribute("hidden") && t.style.display !== "none");
74
+ }
75
+ _onSlotChange() {
76
+ this._filterSuggestions(this.value);
77
+ }
78
+ _onInput(e) {
79
+ const t = e.target;
80
+ this.value = t.value, this._filterSuggestions(this.value), this._activeIndex = -1, this._kbMode = !1, this._updateComboboxA11y(), this.dispatchEvent(new CustomEvent("scb-search-input", {
81
+ detail: { value: this.value },
82
+ bubbles: !0,
83
+ composed: !0
84
+ }));
85
+ }
86
+ _onFocus() {
87
+ this._inputFocused = !0, this._filterSuggestions(this.value), this._updateComboboxA11y(), this.requestUpdate();
88
+ }
89
+ _onBlur() {
90
+ setTimeout(() => {
91
+ this._inputFocused = !1, this._activeIndex = -1, this._kbMode = !1, this._updateComboboxA11y(), this.requestUpdate();
92
+ }, 100);
93
+ }
94
+ _handleKey(e) {
95
+ if (!this._inputEl()) return;
96
+ const i = this._getVisibleItems(), n = (this.value ?? "").trim().length > 0, s = this._inputFocused && n && i.length > 0, r = e.key, a = e.keyCode, c = r === "ArrowDown" || r === "Down" || a === 40, p = r === "ArrowUp" || r === "Up" || a === 38, v = r === "Home" || a === 36, g = r === "End" || a === 35, m = r === "Enter" || a === 13, f = r === "Escape" || r === "Esc" || a === 27;
97
+ if (c) {
98
+ if (!s) return;
99
+ e.preventDefault(), this._kbMode = !0, this._moveActive(i, 1);
100
+ return;
101
+ }
102
+ if (p) {
103
+ if (!s) return;
104
+ e.preventDefault(), this._kbMode = !0, this._moveActive(i, -1);
105
+ return;
106
+ }
107
+ if (v) {
108
+ if (!s) return;
109
+ e.preventDefault(), this._kbMode = !0, this._activeIndex = i.length ? 0 : -1, this._updateComboboxA11y(), this._scrollActiveIntoView();
110
+ return;
111
+ }
112
+ if (g) {
113
+ if (!s) return;
114
+ e.preventDefault(), this._kbMode = !0, this._activeIndex = i.length ? i.length - 1 : -1, this._updateComboboxA11y(), this._scrollActiveIntoView();
115
+ return;
116
+ }
117
+ if (m) {
118
+ if (!s) {
119
+ this.submit();
120
+ return;
121
+ }
122
+ e.preventDefault();
123
+ const u = this._getActiveItem();
124
+ if (u) {
125
+ const _ = u.getAttribute("label") || "";
126
+ this.value = _, this.dispatchEvent(new CustomEvent("scb-search-submit", {
127
+ detail: { value: this.value, active: this._itemPayload(u) },
128
+ bubbles: !0,
129
+ composed: !0
130
+ })), this._visibleSuggestions = 0, this._activeIndex = -1, this._kbMode = !1, this.requestUpdate();
131
+ } else
132
+ this.submit();
133
+ return;
134
+ }
135
+ if (f) {
136
+ e.preventDefault(), this._clearInput();
137
+ return;
138
+ }
139
+ }
140
+ _clearInput() {
141
+ this.value = "", this._activeIndex = -1, this._kbMode = !1;
142
+ const e = this._inputEl();
143
+ e == null || e.focus(), e && (e.value = ""), this._filterSuggestions(""), this._updateComboboxA11y(), this.dispatchEvent(new CustomEvent("scb-search-clear", { bubbles: !0, composed: !0 }));
144
+ }
145
+ _filterSuggestions(e) {
146
+ const t = (e ?? "").trim().toLowerCase(), i = Array.from(this.querySelectorAll("scb-list-item"));
147
+ let n = 0;
148
+ for (const s of i) {
149
+ const r = (s.getAttribute("label") || "").toLowerCase(), a = (s.getAttribute("supporting-text") || "").toLowerCase(), c = `${r} ${a}`.trim();
150
+ t !== "" && c.includes(t) ? (s.removeAttribute("hidden"), n++) : s.setAttribute("hidden", ""), this._ensureOptionA11y(s);
151
+ }
152
+ this._visibleSuggestions = n, this._activeIndex >= n && (this._activeIndex = -1), this._updateComboboxA11y(), this.requestUpdate();
153
+ }
154
+ _inputEl() {
155
+ var e;
156
+ return ((e = this.renderRoot) == null ? void 0 : e.querySelector("#searchInput")) ?? null;
157
+ }
158
+ _listEl() {
159
+ var e;
160
+ return ((e = this.renderRoot) == null ? void 0 : e.querySelector("scb-list.suggestion-list")) ?? null;
161
+ }
162
+ _getVisibleItems() {
163
+ return Array.from(this.querySelectorAll("scb-list-item")).filter((t) => !t.hasAttribute("hidden") && t.style.display !== "none");
164
+ }
165
+ _getActiveItem() {
166
+ const e = this._getVisibleItems();
167
+ return this._activeIndex < 0 || this._activeIndex >= e.length ? null : e[this._activeIndex] ?? null;
168
+ }
169
+ _moveActive(e, t) {
170
+ if (!e.length) {
171
+ this._activeIndex = -1, this._updateComboboxA11y();
172
+ return;
173
+ }
174
+ let i = this._activeIndex + t;
175
+ this._activeIndex === -1 ? i = t > 0 ? 0 : e.length - 1 : (i < 0 && (i = 0), i >= e.length && (i = e.length - 1)), this._activeIndex = i, this._updateComboboxA11y(), this._scrollActiveIntoView();
176
+ }
177
+ _scrollActiveIntoView() {
178
+ const e = this._getActiveItem();
179
+ e && e.scrollIntoView({ block: "nearest" });
180
+ }
181
+ _itemPayload(e) {
182
+ return {
183
+ label: e.getAttribute("label") || "",
184
+ supportingText: e.getAttribute("supporting-text") || "",
185
+ href: e.getAttribute("href") || "",
186
+ type: e.getAttribute("type") || "",
187
+ id: e.id || ""
188
+ };
189
+ }
190
+ _ensureListboxA11y() {
191
+ const e = this._listEl();
192
+ e && (e.id || (e.id = this._listboxId), e.setAttribute("role", "listbox"), e.setAttribute("aria-label", "Sökförslag")), Array.from(this.querySelectorAll("scb-list-item")).forEach((i) => this._ensureOptionA11y(i));
193
+ }
194
+ _ensureOptionA11y(e) {
195
+ e.id || (e.id = `${this._listboxId}-opt-${Math.random().toString(36).slice(2, 8)}`), e.setAttribute("role", "option"), e.setAttribute("tabindex", "-1");
196
+ }
197
+ _updateComboboxA11y() {
198
+ const e = this._inputEl();
199
+ if (!e) return;
200
+ const t = this._getVisibleItems(), i = (this.value ?? "").trim().length > 0, n = this._inputFocused && i && t.length > 0;
201
+ e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-controls", this._listboxId), e.setAttribute("aria-expanded", String(n));
202
+ const s = n ? this._getActiveItem() : null;
203
+ s != null && s.id ? e.setAttribute("aria-activedescendant", s.id) : e.removeAttribute("aria-activedescendant"), t.forEach((r, a) => {
204
+ const c = a === this._activeIndex;
205
+ r.setAttribute("aria-selected", String(c)), r.style.boxShadow = "", r.style.borderRadius = "", this._kbMode && c && (r.style.boxShadow = "inset 0 0 0 var(--md-focus-ring-width, 2px) var(--md-focus-ring-color, var(--p-40))", r.style.borderRadius = "var(--md-sys-shape-corner-small, 8px)");
206
+ });
207
+ }
208
+ };
209
+ o.styles = y`
210
+ :host {
211
+ display: flex;
212
+ flex-direction: column;
213
+ position: relative;
214
+ color: var(--md-sys-color-on-surface);
215
+ -webkit-tap-highlight-color: transparent;
216
+
217
+ --scb-search-radius: var(--radius-full, 1000px);
218
+ --scb-search-open-radius: var(--radius-xl, 24px);
219
+
220
+ --scb-search-height: 56px;
221
+ --scb-search-padding-x: var(--spacing-5, 16px);
222
+ --scb-search-padding-y: var(--spacing-5, 16px);
223
+
224
+ --scb-search-leading-size: var(--scale-11, 48px);
225
+ --scb-search-trailing-size: var(--scale-11, 48px);
226
+ --scb-search-gap: var(--spacing-2, 4px);
227
+
228
+ letter-spacing: var(--md-sys-typescale-body-large-tracking, -0.3px);
229
+
230
+ --scb-search-leading-gap: calc(
231
+ var(--scb-search-padding-x) + var(--scb-search-leading-size) + var(--scb-search-gap)
232
+ );
233
+ --scb-search-trailing-gap: calc(
234
+ var(--scb-search-padding-x) + var(--scb-search-trailing-size) + var(--scb-search-gap)
235
+ );
236
+
237
+ --scb-search-font-size: var(--md-sys-typescale-body-large-size, 18px);
238
+ --scb-search-line-height: var(--md-sys-typescale-body-large-line-height, 24px);
239
+ --scb-search-icon-size: var(--icon-size-small, 24px);
240
+ }
241
+
242
+ :host([size="compact"]) {
243
+ --scb-search-height: var(--scale-11, 40px);
244
+ --scb-search-padding-x: var(--spacing-4, 12px);
245
+ --scb-search-padding-y: var(--spacing-3, 8px);
246
+ --scb-search-open-radius: var(--radius-l, 16px);
247
+ --scb-search-font-size: var(--md-sys-typescale-body-medium-size, 0.875rem);
248
+ --scb-search-line-height: var(--md-sys-typescale-body-medium-line-height, 20px);
249
+ }
250
+
251
+ .ripple-wrapper {
252
+ position: relative;
253
+ display: flex;
254
+ align-items: center;
255
+ width: 100%;
256
+ }
257
+
258
+ .leading {
259
+ position: absolute;
260
+ left: var(--scb-search-padding-x);
261
+ top: 50%;
262
+ transform: translateY(-50%);
263
+ width: var(--scb-search-leading-size);
264
+ height: var(--scb-search-leading-size);
265
+ display: flex;
266
+ align-items: center;
267
+ justify-content: center;
268
+ pointer-events: none;
269
+ color: var(--md-sys-color-on-surface-variant);
270
+ z-index: 2;
271
+ }
272
+ .leading md-icon {
273
+ font-size: var(--scb-search-icon-size);
274
+ line-height: 1;
275
+ }
276
+
277
+ .trailing,
278
+ .clear-btn {
279
+ position: absolute;
280
+ right: var(--scb-search-padding-x);
281
+ top: 50%;
282
+ transform: translateY(-50%);
283
+ width: var(--scb-search-trailing-size);
284
+ height: var(--scb-search-trailing-size);
285
+ display: inline-flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ color: var(--md-sys-color-on-surface-variant);
289
+ z-index: 3;
290
+ }
291
+ .trailing md-icon { pointer-events: none; font-size: var(--scb-search-icon-size); }
292
+
293
+ .clear-btn {
294
+ background: none;
295
+ border: 0;
296
+ padding: 0;
297
+ cursor: pointer;
298
+ }
299
+ .clear-btn[hidden] { display: none; }
300
+
301
+ input[type="search"] {
302
+ padding:
303
+ var(--scb-search-padding-y)
304
+ var(--scb-search-trailing-gap)
305
+ var(--scb-search-padding-y)
306
+ var(--scb-search-leading-gap);
307
+ min-height: var(--scb-search-height);
308
+ width: 100%;
309
+ box-sizing: border-box;
310
+
311
+ border: var(--stroke-border, 1px) solid var(--md-sys-color-outline);
312
+ border-radius: var(--scb-search-radius);
313
+
314
+ font-family: var(--md-sys-typescale-body-large-font, var(--brand-font, Inter), sans-serif);
315
+ font-size: var(--scb-search-font-size);
316
+ line-height: var(--scb-search-line-height);
317
+
318
+ color: var(--md-sys-color-on-surface);
319
+ background: var(--md-sys-color-surface);
320
+
321
+ position: relative;
322
+ z-index: 1;
323
+ }
324
+ input[type="search"]::placeholder {
325
+ color: var(--md-sys-color-on-surface-variant);
326
+ font-size: var(--scb-search-font-size);
327
+ line-height: var(--scb-search-line-height);
328
+ }
329
+ input[type="search"]:hover { outline: var(--md-sys-color-outline) auto var(--stroke-border, 1px); }
330
+ input[type="search"]:focus { outline: none; }
331
+
332
+ md-ripple {
333
+ border-radius: var(--scb-search-radius);
334
+ position: absolute;
335
+ inset: 0;
336
+ z-index: 2;
337
+ pointer-events: none;
338
+ --md-ripple-hover-color: transparent;
339
+ --md-ripple-hover-opacity: 0;
340
+ }
341
+
342
+ input[type="search"]::-webkit-search-cancel-button {
343
+ -webkit-appearance: none;
344
+ appearance: none;
345
+ display: none;
346
+ }
347
+
348
+ input.with-list { border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0; }
349
+ input.with-list ~ md-ripple { border-radius: var(--scb-search-open-radius) var(--scb-search-open-radius) 0 0; }
350
+
351
+ scb-list.suggestion-list {
352
+ position: absolute;
353
+ top: 100%;
354
+ left: 0;
355
+ width: 100%;
356
+ z-index: 10;
357
+ background: var(--md-sys-color-surface);
358
+ border: var(--stroke-border, 1px) solid var(--md-sys-color-outline);
359
+ border-top: 0;
360
+ border-radius: 0 0 var(--scb-search-open-radius) var(--scb-search-open-radius);
361
+ overflow: hidden;
362
+ box-sizing: border-box;
363
+ }
364
+
365
+ :host([full-screen]) input[type="search"],
366
+ :host([full-screen]) input.with-list,
367
+ :host([full-screen]) input.with-list ~ md-ripple,
368
+ :host([full-screen]) md-ripple {
369
+ border-radius: var(--radius-none, 0px) !important;
370
+ }
371
+ :host([full-screen]) scb-list.suggestion-list {
372
+ position: static;
373
+ border: 0;
374
+ border-radius: 0;
375
+ background: transparent;
376
+ }
377
+
378
+ .list-divider {
379
+ display: none;
380
+ height: var(--stroke-border, 1px);
381
+ background: var(--md-sys-color-outline);
382
+ width: 100%;
383
+ }
384
+ :host([full-screen]) .list-divider[aria-hidden="false"] { display: block; }
385
+
386
+ @media (prefers-color-scheme: dark) {
387
+ :host { color: var(--md-sys-color-on-surface); }
388
+ }
389
+ `;
390
+ l([
391
+ h({ type: String, attribute: "trailing-icon" })
392
+ ], o.prototype, "trailingIcon", 2);
393
+ l([
394
+ h({ type: String, attribute: "supporting-text" })
395
+ ], o.prototype, "supportingText", 2);
396
+ l([
397
+ h({ type: String })
398
+ ], o.prototype, "value", 2);
399
+ l([
400
+ h({ type: String, reflect: !0 })
401
+ ], o.prototype, "size", 2);
402
+ l([
403
+ h({ type: Boolean, attribute: "full-screen", reflect: !0 })
404
+ ], o.prototype, "fullScreen", 2);
405
+ o = l([
406
+ A("scb-search")
407
+ ], o);
408
+ export {
409
+ o as ScbSearch
410
+ };
@@ -0,0 +1,17 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ export declare class ScbSnackbar extends LitElement {
4
+ message: string;
5
+ open: boolean;
6
+ actionText: string;
7
+ showClose: boolean;
8
+ fixed: boolean;
9
+ fadeout: boolean;
10
+ withLongerAction: boolean;
11
+ private _fadeoutTimer;
12
+ static styles: import('lit').CSSResult;
13
+ private handleAction;
14
+ private handleClose;
15
+ updated(changedProps: Map<string, any>): void;
16
+ render(): import('lit-html').TemplateResult<1>;
17
+ }
@@ -0,0 +1,140 @@
1
+ import { css as d, LitElement as m, html as r } from "lit";
2
+ import { property as a, customElement as u } from "lit/decorators.js";
3
+ import "../scb-icon-button/scb-icon-button.js";
4
+ import "../scb-button/scb-button.js";
5
+ var h = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (t, e, n, c) => {
6
+ for (var i = c > 1 ? void 0 : c ? b(e, n) : e, l = t.length - 1, p; l >= 0; l--)
7
+ (p = t[l]) && (i = (c ? p(e, n, i) : p(i)) || i);
8
+ return c && i && h(e, n, i), i;
9
+ };
10
+ let o = class extends m {
11
+ constructor() {
12
+ super(...arguments), this.message = "", this.open = !1, this.actionText = "", this.showClose = !1, this.fixed = !1, this.fadeout = !1, this.withLongerAction = !1;
13
+ }
14
+ handleAction() {
15
+ this.dispatchEvent(new CustomEvent("snackbar-action")), this.open = !1;
16
+ }
17
+ handleClose() {
18
+ this.dispatchEvent(new CustomEvent("snackbar-close")), this.open = !1;
19
+ }
20
+ updated(t) {
21
+ super.updated(t), (t.has("open") || t.has("fadeout")) && (this.open && this.fadeout ? (window.clearTimeout(this._fadeoutTimer), this._fadeoutTimer = window.setTimeout(() => {
22
+ this.open = !1;
23
+ }, 5e3)) : window.clearTimeout(this._fadeoutTimer));
24
+ }
25
+ render() {
26
+ const t = !!this.actionText, e = !!this.showClose;
27
+ let n = "snackbar";
28
+ return !t && !e && (n += " no-actions"), this.withLongerAction && (n += " longer-action"), r`
29
+ <div class="${n}" ?hidden=${!this.open}>
30
+ ${this.withLongerAction ? r`
31
+ <div class="message">${this.message}</div>
32
+ <div class="actions">
33
+ ${t ? r`<scb-button variant="text" label=${this.actionText} @click=${this.handleAction}></scb-button>` : ""}
34
+ ${e ? r`<scb-icon-button icon="close" @click=${this.handleClose} aria-label="Stäng"></scb-icon-button>` : ""}
35
+ </div>
36
+ ` : r`
37
+ <span class="message">${this.message}</span>
38
+ ${t ? r`<scb-button variant="text" label=${this.actionText} @click=${this.handleAction}></scb-button>` : ""}
39
+ ${e ? r`<scb-icon-button icon="close" @click=${this.handleClose} aria-label="Stäng"></scb-icon-button>` : ""}
40
+ `}
41
+
42
+ </div>
43
+ `;
44
+ }
45
+ };
46
+ o.styles = d`
47
+ :host {
48
+ position: relative;
49
+ display: block;
50
+ min-width: 312px;
51
+ max-width: 560px;
52
+ }
53
+ :host([fixed]) {
54
+ position: fixed;
55
+ z-index: 9999;
56
+ left: 50%;
57
+ bottom: 24px;
58
+ transform: translateX(-50%);
59
+ }
60
+ .snackbar {
61
+ background: var(--md-sys-color-inverse-surface);
62
+ color: var(--md-sys-color-inverse-on-surface);
63
+ border-radius: 4px;
64
+ box-shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.30);
65
+ display: flex;
66
+ align-items: center;
67
+ padding: 14px 16px;
68
+ font-size: 16px;
69
+ opacity: 0;
70
+ transition: opacity 0.3s, bottom 0.3s;
71
+ pointer-events: auto;
72
+ position: relative;
73
+ }
74
+ .snackbar.longer-action {
75
+ flex-direction: column;
76
+ align-items: flex-start;
77
+ }
78
+ .snackbar .actions {
79
+ display: flex;
80
+ margin-top: 10px;
81
+ width: 100%;
82
+ justify-content: flex-end;
83
+
84
+ }
85
+ .message.no-actions {
86
+ margin-right: 0;
87
+ }
88
+ :host([open]) .snackbar {
89
+ opacity: 1;
90
+ pointer-events: auto;
91
+ }
92
+ .message {
93
+ flex: 1 1 auto;
94
+ margin-right: 4px;
95
+ }
96
+ .snackbar scb-icon-button{
97
+ --md-icon-button-icon-color: var(--md-sys-color-inverse-on-surface);
98
+ --md-icon-button-hover-icon-color: var(--md-sys-color-inverse-on-surface);
99
+ --md-icon-button-hover-state-layer-color: var(--md-sys-color-surface-container);
100
+ --md-icon-button-focus-icon-color: var(--md-sys-color-inverse-on-surface);
101
+ --md-icon-button-pressed-icon-color: var(--md-sys-color-inverse-on-surface);
102
+ --md-focus-ring-color: var(--md-sys-color-inverse-on-surface);
103
+ }
104
+ .snackbar scb-button{
105
+ --md-text-button-label-text-color: var(--md-sys-color-inverse-primary);
106
+ --md-text-button-hover-label-text-color: var(--md-sys-color-inverse-primary);
107
+ --md-text-button-hover-state-layer-color: var(--md-sys-color-surface-container);
108
+ --md-text-button-focus-label-text-color: var(--md-sys-color-inverse-primary);
109
+ --md-text-button-pressed-label-text-color: var(--md-sys-color-inverse-primary);
110
+ --md-focus-ring-color: var(--md-sys-color-inverse-on-surface);
111
+ }
112
+
113
+ `;
114
+ s([
115
+ a({ type: String })
116
+ ], o.prototype, "message", 2);
117
+ s([
118
+ a({ type: Boolean, reflect: !0 })
119
+ ], o.prototype, "open", 2);
120
+ s([
121
+ a({ type: String, attribute: "action-text" })
122
+ ], o.prototype, "actionText", 2);
123
+ s([
124
+ a({ type: Boolean, attribute: "show-close" })
125
+ ], o.prototype, "showClose", 2);
126
+ s([
127
+ a({ type: Boolean, reflect: !0 })
128
+ ], o.prototype, "fixed", 2);
129
+ s([
130
+ a({ type: Boolean })
131
+ ], o.prototype, "fadeout", 2);
132
+ s([
133
+ a({ type: Boolean, attribute: "with-longer-action" })
134
+ ], o.prototype, "withLongerAction", 2);
135
+ o = s([
136
+ u("scb-snackbar")
137
+ ], o);
138
+ export {
139
+ o as ScbSnackbar
140
+ };
@@ -0,0 +1,9 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ export declare class ScbStatusPill extends LitElement {
4
+ status: string;
5
+ label: string;
6
+ showIcon: boolean;
7
+ static styles: import('lit').CSSResult;
8
+ render(): import('lit-html').TemplateResult<1>;
9
+ }
@@ -0,0 +1,62 @@
1
+ import { css as u, LitElement as d, html as e } from "lit";
2
+ import { property as l, customElement as m } from "lit/decorators.js";
3
+ import "@material/web/icon/icon.js";
4
+ var h = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (p, o, c, t) => {
5
+ for (var s = t > 1 ? void 0 : t ? b(o, c) : o, i = p.length - 1, a; i >= 0; i--)
6
+ (a = p[i]) && (s = (t ? a(o, c, s) : a(s)) || s);
7
+ return t && s && h(o, c, s), s;
8
+ };
9
+ let r = class extends d {
10
+ constructor() {
11
+ super(...arguments), this.status = "", this.label = "", this.showIcon = !1;
12
+ }
13
+ render() {
14
+ return e`
15
+ ${this.showIcon ? this.status === "success" ? e`<md-icon>check_circle</md-icon>` : this.status === "warning" ? e`<md-icon>warning</md-icon>` : this.status === "error" ? e`<md-icon>error</md-icon>` : "" : ""}
16
+ <span>${this.label}</span>
17
+ `;
18
+ }
19
+ };
20
+ r.styles = u`
21
+ :host {
22
+ display: inline-block;
23
+ border-radius: 999px;
24
+ padding: 6px 16px;
25
+ font-size: 14px;
26
+ font-weight: 600;
27
+ border: none;
28
+ box-sizing: border-box;
29
+ user-select: none;
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 8px;
33
+ width: fit-content;
34
+ }
35
+ :host([status="success"]) {
36
+ background: var(--md-sys-color-success-container);
37
+ color: var(--md-sys-color-on-success-container);
38
+ }
39
+ :host([status="warning"]) {
40
+ background: var(--md-sys-color-warning-container);
41
+ color: var(--md-sys-color-on-warning-container);
42
+ }
43
+ :host([status="error"]) {
44
+ background: var(--md-sys-color-error-container);
45
+ color: var(--md-sys-color-on-error-container);
46
+ }
47
+ `;
48
+ n([
49
+ l({ type: String })
50
+ ], r.prototype, "status", 2);
51
+ n([
52
+ l({ type: String })
53
+ ], r.prototype, "label", 2);
54
+ n([
55
+ l({ type: Boolean, attribute: "show-icon" })
56
+ ], r.prototype, "showIcon", 2);
57
+ r = n([
58
+ m("scb-status-pill")
59
+ ], r);
60
+ export {
61
+ r as ScbStatusPill
62
+ };
@@ -0,0 +1,21 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+
3
+ export declare class ScbSwitch extends LitElement {
4
+ #private;
5
+ label: string;
6
+ ariaLabel: string;
7
+ icons: boolean;
8
+ selected: boolean;
9
+ disabled: boolean;
10
+ /** Full-width layout: space-between + width:100% när true */
11
+ fullWidth: boolean;
12
+ static styles: import('lit').CSSResult;
13
+ protected updated(): void;
14
+ protected firstUpdated(): Promise<void>;
15
+ render(): TemplateResult;
16
+ }
17
+ declare global {
18
+ interface HTMLElementTagNameMap {
19
+ 'scb-switch': ScbSwitch;
20
+ }
21
+ }