@skf-design-system/ui-components 1.0.0-alpha.27 → 1.0.0-alpha.28
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.
- package/README.md +26 -6
- package/custom-elements.json +18265 -0
- package/dist/components/alert/alert.component.js +20 -18
- package/dist/components/alert/alert.styles.js +50 -47
- package/dist/components/button/button.component.d.ts +24 -0
- package/dist/components/button/button.component.js +79 -55
- package/dist/components/button/button.styles.js +1 -0
- package/dist/components/checkbox/checkbox.component.d.ts +3 -8
- package/dist/components/checkbox/checkbox.component.js +95 -90
- package/dist/components/checkbox/checkbox.styles.js +2 -2
- package/dist/components/input/input.component.d.ts +10 -0
- package/dist/components/input/input.component.js +89 -82
- package/dist/components/progress/progress.component.d.ts +22 -0
- package/dist/components/progress/progress.component.js +40 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +6 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.styles.js +47 -0
- package/dist/components/radio/radio.component.d.ts +4 -6
- package/dist/components/radio/radio.component.js +93 -77
- package/dist/components/select/select.component.d.ts +5 -2
- package/dist/components/select/select.component.js +103 -88
- package/dist/components/select/select.controllers.js +5 -2
- package/dist/components/switch/switch.component.js +4 -1
- package/dist/components/tab/tab.component.d.ts +29 -0
- package/dist/components/tab/tab.component.js +57 -0
- package/dist/components/tab/tab.d.ts +8 -0
- package/dist/components/tab/tab.js +6 -0
- package/dist/components/tab/tab.styles.d.ts +1 -0
- package/dist/components/tab/tab.styles.js +123 -0
- package/dist/components/tab-group/tab-group.component.d.ts +43 -0
- package/dist/components/tab-group/tab-group.component.js +98 -0
- package/dist/components/tab-group/tab-group.d.ts +8 -0
- package/dist/components/tab-group/tab-group.js +6 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
- package/dist/components/tab-group/tab-group.styles.js +75 -0
- package/dist/components/tab-panel/tab-panel.component.d.ts +19 -0
- package/dist/components/tab-panel/tab-panel.component.js +36 -0
- package/dist/components/tab-panel/tab-panel.d.ts +8 -0
- package/dist/components/tab-panel/tab-panel.js +6 -0
- package/dist/components/tab-panel/tab-panel.styles.d.ts +1 -0
- package/dist/components/tab-panel/tab-panel.styles.js +13 -0
- package/dist/components/textarea/textarea.component.js +5 -5
- package/dist/components/toast/toast.component.d.ts +35 -0
- package/dist/components/toast/toast.component.js +52 -0
- package/dist/components/toast/toast.d.ts +8 -0
- package/dist/components/toast/toast.js +6 -0
- package/dist/components/toast/toast.singleton.d.ts +26 -0
- package/dist/components/toast/toast.singleton.js +53 -0
- package/dist/components/toast/toast.styles.d.ts +1 -0
- package/dist/components/toast/toast.styles.js +9 -0
- package/dist/components/toast-item/toast-item.component.d.ts +21 -0
- package/dist/components/toast-item/toast-item.component.js +65 -0
- package/dist/components/toast-item/toast-item.d.ts +6 -0
- package/dist/components/toast-item/toast-item.js +2 -0
- package/dist/components/toast-item/toast-item.styles.d.ts +2 -0
- package/dist/components/toast-item/toast-item.styles.js +16 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.d.ts +24 -0
- package/dist/components/toast-wrapper/toast-wrapper.component.js +37 -0
- package/dist/components/toast-wrapper/toast-wrapper.d.ts +8 -0
- package/dist/components/toast-wrapper/toast-wrapper.js +6 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.d.ts +1 -0
- package/dist/components/toast-wrapper/toast-wrapper.styles.js +20 -0
- package/dist/custom-elements.json +1167 -311
- package/dist/index.d.ts +5 -0
- package/dist/index.js +57 -42
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -11
- package/dist/internal/helpers/watch.d.ts +27 -0
- package/dist/internal/helpers/watch.js +28 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-progress/index.d.ts +3 -0
- package/dist/react/skf-progress/index.js +13 -0
- package/dist/react/skf-tab/index.d.ts +12 -0
- package/dist/react/skf-tab/index.js +18 -0
- package/dist/react/skf-tab-group/index.d.ts +3 -0
- package/dist/react/skf-tab-group/index.js +13 -0
- package/dist/react/skf-tab-panel/index.d.ts +3 -0
- package/dist/react/skf-tab-panel/index.js +13 -0
- package/dist/react/skf-toast/index.d.ts +3 -0
- package/dist/react/skf-toast/index.js +13 -0
- package/dist/react/skf-toast-wrapper/index.d.ts +3 -0
- package/dist/react/skf-toast-wrapper/index.js +13 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +115 -1096
- package/dist/types/vue/index.d.ts +147 -8
- package/dist/vscode.html-custom-data.json +116 -16
- package/dist/web-types.json +304 -35
- package/package.json +27 -27
@@ -1,29 +1,29 @@
|
|
1
|
-
import { computePosition as
|
1
|
+
import { computePosition as v, flip as f, shift as _, offset as g } from "@floating-ui/dom";
|
2
2
|
import { FormBase as b } from "../../internal/components/formBase.js";
|
3
3
|
import { findMatchingTags as y } from "../../internal/helpers/findMatchingTags.js";
|
4
4
|
import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
|
5
|
-
import { raiseError as
|
6
|
-
import { Asterisk as
|
7
|
-
import
|
8
|
-
import { html as h, nothing as
|
9
|
-
import { property as
|
10
|
-
import { classMap as
|
5
|
+
import { raiseError as w } from "../../internal/helpers/raiseError.js";
|
6
|
+
import { Asterisk as x } from "../../internal/templates/asterisk.js";
|
7
|
+
import $ from "../../styles/component.styles.js";
|
8
|
+
import { html as h, nothing as V } from "lit";
|
9
|
+
import { property as o, state as d, query as p } from "lit/decorators.js";
|
10
|
+
import { classMap as S } from "lit/directives/class-map.js";
|
11
11
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
12
12
|
import "../../internal/components/hint/hint.js";
|
13
13
|
import "../tag/tag.js";
|
14
|
-
import { ScrollController as C, ResizeController as k, GlobalClickController as
|
14
|
+
import { ScrollController as C, ResizeController as k, GlobalClickController as L, KeyboardNavigationController as A, DeveloperFeedbackController as E } from "./select.controllers.js";
|
15
15
|
import { styles as P } from "./select.styles.js";
|
16
|
-
var
|
17
|
-
for (var
|
18
|
-
(a = u[n]) && (
|
19
|
-
return
|
16
|
+
var T = Object.defineProperty, D = Object.getOwnPropertyDescriptor, l = (u, t, e, i) => {
|
17
|
+
for (var r = i > 1 ? void 0 : i ? D(t, e) : t, n = u.length - 1, a; n >= 0; n--)
|
18
|
+
(a = u[n]) && (r = (i ? a(t, e, r) : a(r)) || r);
|
19
|
+
return i && r && T(t, e, r), r;
|
20
20
|
};
|
21
21
|
const c = class c extends b {
|
22
22
|
constructor() {
|
23
|
-
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new
|
23
|
+
super(), this.selectDelay = 200, this._optionsList = [], this.buttonLabel = "Select an option", this.size = "md", this._expanded = !1, this._invalid = !1, this.scrollController = new C(this), this.resizeController = new k(this), this.globalClickController = new L(this), this.keyboardNavController = new A(this), this.developerFeedbackController = new E(this), this._handleOptionSelected = (t) => {
|
24
24
|
this._pristine = !1;
|
25
25
|
const e = this._selectedOptions.length > 0;
|
26
|
-
this.setFormValue(e ? this.
|
26
|
+
this.setFormValue(e ? this.selectedValues.join(",") : null), this._updateState(t);
|
27
27
|
}, this._handleReset = () => {
|
28
28
|
this.emitEvent("reset"), this._resetSelectedOptions();
|
29
29
|
}, this._updateWidth = () => {
|
@@ -32,15 +32,15 @@ const c = class c extends b {
|
|
32
32
|
(t = this.$dropdown) == null || t.style.setProperty("--select-width", `${String(this.offsetWidth)}px`);
|
33
33
|
}, 50);
|
34
34
|
}, this._managePopover = () => ({ close: () => {
|
35
|
-
var
|
36
|
-
(
|
35
|
+
var i;
|
36
|
+
(i = this.$dropdown) == null || i.hidePopover();
|
37
37
|
}, open: () => {
|
38
|
-
const
|
39
|
-
!
|
38
|
+
const i = this.$selectBtn, r = this.$dropdown;
|
39
|
+
!i || !r || (r.showPopover(), v(i, r, {
|
40
40
|
placement: "bottom",
|
41
|
-
middleware: [
|
41
|
+
middleware: [f(), _({ padding: 5 }), g(2)]
|
42
42
|
}).then(({ x: n, y: a }) => {
|
43
|
-
Object.assign(
|
43
|
+
Object.assign(r.style, {
|
44
44
|
left: `${String(n)}px`,
|
45
45
|
top: `${String(Math.round(a - window.scrollY))}px`
|
46
46
|
});
|
@@ -55,10 +55,10 @@ const c = class c extends b {
|
|
55
55
|
this.setFormValue(null), this.requestUpdate();
|
56
56
|
break;
|
57
57
|
case this._selectedOptions.length === 1:
|
58
|
-
this.setFormValue(this.
|
58
|
+
this.setFormValue(this.selectedValues[0]);
|
59
59
|
break;
|
60
60
|
case this._selectedOptions.length > 1:
|
61
|
-
this.setFormValue(this.
|
61
|
+
this.setFormValue(this.selectedValues.join(","));
|
62
62
|
break;
|
63
63
|
default:
|
64
64
|
throw new Error("Something went wrong");
|
@@ -68,8 +68,8 @@ const c = class c extends b {
|
|
68
68
|
});
|
69
69
|
}), this._resetSelectedOptions = (t) => {
|
70
70
|
const e = !t;
|
71
|
-
this._optionsList.forEach((
|
72
|
-
(e ||
|
71
|
+
this._optionsList.forEach((i) => {
|
72
|
+
(e || i !== t) && i.removeAttribute("selected");
|
73
73
|
});
|
74
74
|
}, this._handleSlotChange = () => {
|
75
75
|
this._collectSlotOptionTags(), this._validateInput();
|
@@ -78,11 +78,23 @@ const c = class c extends b {
|
|
78
78
|
return (t = this.$selectedValue) == null || t.classList.add("contains-meta-info"), this._selectedOptions.length > 1 ? `(${String(this._selectedOptions.length)} items selected)` : this.value ? ((e = this.$selectedValue) == null || e.classList.remove("contains-meta-info"), this.value) : this.buttonLabel;
|
79
79
|
}, this._selectedOptions = [];
|
80
80
|
}
|
81
|
-
|
81
|
+
set selectedValues(t) {
|
82
|
+
this._selectedOptions = this._optionsList.filter((e) => t.includes(e.value.trim()));
|
83
|
+
}
|
84
|
+
get selectedValues() {
|
82
85
|
return this._selectedOptions.map((t) => t.value.trim());
|
83
86
|
}
|
84
|
-
|
85
|
-
|
87
|
+
set selectedOptionsText(t) {
|
88
|
+
this._selectedOptions = this._selectedOptions.filter(
|
89
|
+
(e) => e.textContent && t.includes(e.textContent)
|
90
|
+
);
|
91
|
+
}
|
92
|
+
get selectedOptionsText() {
|
93
|
+
return this._selectedOptions.map((t) => t.textContent ?? "");
|
94
|
+
}
|
95
|
+
set value(t) {
|
96
|
+
const e = t.split(",").map((i) => i.trim());
|
97
|
+
this._selectedOptions = this._optionsList.filter((i) => e.includes(i.value.trim()));
|
86
98
|
}
|
87
99
|
get value() {
|
88
100
|
return this._selectedOptions.length ? this._selectedOptions.length === 1 ? this._selectedOptions[0].value.trim() : this._selectedOptions.map((t) => t.value.trim()).join(",") : "";
|
@@ -113,20 +125,19 @@ const c = class c extends b {
|
|
113
125
|
}
|
114
126
|
firstUpdated() {
|
115
127
|
var t;
|
116
|
-
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this.
|
128
|
+
this.addEventListener("skf-select-option:select", this._handleOptionSelected), (t = this._internals.form) == null || t.addEventListener("reset", this._handleReset), this.onUpdateComplete(), this._validateInput();
|
117
129
|
}
|
118
130
|
updated(t) {
|
119
|
-
var e, s;
|
120
131
|
if (t.has("_expanded")) {
|
121
|
-
const
|
122
|
-
if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }),
|
123
|
-
this._expanded ?
|
132
|
+
const e = !!t.get("_expanded") === this._expanded;
|
133
|
+
if (this.emit("skf-select:dropdown", { detail: { expanded: this._expanded } }), e) return;
|
134
|
+
this._expanded ? this._managePopover().open() : this._managePopover().close();
|
124
135
|
}
|
125
136
|
}
|
126
|
-
attributeChangedCallback(t, e,
|
127
|
-
if (super.attributeChangedCallback(t, e,
|
128
|
-
if (typeof
|
129
|
-
const n =
|
137
|
+
attributeChangedCallback(t, e, i) {
|
138
|
+
if (super.attributeChangedCallback(t, e, i), t === "custom-invalid")
|
139
|
+
if (typeof i == "string") {
|
140
|
+
const n = this.withFallback(i);
|
130
141
|
this._pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, n), this.checkValidity();
|
131
142
|
} else
|
132
143
|
this.setValidity({}), this._validateInput();
|
@@ -142,8 +153,8 @@ const c = class c extends b {
|
|
142
153
|
e.selected && (this.selectedOptions = [...this.selectedOptions, e]);
|
143
154
|
});
|
144
155
|
else {
|
145
|
-
const e = this._selectedOptions.length > 0,
|
146
|
-
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []),
|
156
|
+
const e = this._selectedOptions.length > 0, i = t.detail.value !== null;
|
157
|
+
e && (this._selectedOptions[0].setSelectedDiscrete = !1, this._selectedOptions = []), i && (this.selectedOptions = [t.target]);
|
147
158
|
}
|
148
159
|
this._setValue();
|
149
160
|
}
|
@@ -154,7 +165,7 @@ const c = class c extends b {
|
|
154
165
|
/** @internal */
|
155
166
|
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
156
167
|
_collectSlotOptionTags() {
|
157
|
-
this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected),
|
168
|
+
this._optionsList = y(this, "skf-select-option"), this._selectedOptions = this._optionsList.filter((t) => t.selected), w({
|
158
169
|
assert: this._optionsList.length > 0,
|
159
170
|
reason: "no-children",
|
160
171
|
replaceStrings: [this.localName, "skf-select-option"]
|
@@ -163,7 +174,7 @@ const c = class c extends b {
|
|
163
174
|
/** @internal */
|
164
175
|
_validateInput() {
|
165
176
|
this._invalid = !1;
|
166
|
-
const t = this.required && !this.
|
177
|
+
const t = this.required && !this.selectedValues.length || this.min === 1, e = !!(this.min && this.selectedValues.length < this.min), i = !!(this.max && this.selectedValues.length > this.max);
|
167
178
|
if (this._internals.validity.customError) {
|
168
179
|
this._invalid = !0;
|
169
180
|
return;
|
@@ -173,7 +184,7 @@ const c = class c extends b {
|
|
173
184
|
} else if (e) {
|
174
185
|
const n = this.hasAttribute("data-rangeunderflow") ? this.getAttribute("data-rangeunderflow") : `Please select minimum ${String(this.min)} options`;
|
175
186
|
this.setValidity({ rangeUnderflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
176
|
-
} else if (
|
187
|
+
} else if (i) {
|
177
188
|
const n = this.hasAttribute("data-rangeoverflow") ? this.getAttribute("data-rangeoverflow") : `Please select maximum ${String(this.max)} options`;
|
178
189
|
this.setValidity({ rangeOverflow: !0 }, String(n)), this._pristine || (this._invalid = !0);
|
179
190
|
} else
|
@@ -185,13 +196,14 @@ const c = class c extends b {
|
|
185
196
|
<label>
|
186
197
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
187
198
|
${this.label}
|
188
|
-
${this.required ?
|
199
|
+
${this.required ? x(this.requiredLabel) : null}
|
189
200
|
</div>
|
190
201
|
<button
|
191
202
|
?disabled=${this.disabled}
|
192
203
|
@click=${this._handleDropdownToggle}
|
193
204
|
aria-controls="select-dropdown"
|
194
|
-
aria-expanded
|
205
|
+
aria-expanded=${this._expanded}
|
206
|
+
aria-invalid=${this._invalid}
|
195
207
|
aria-haspopup="listbox"
|
196
208
|
class="skf-icon-host"
|
197
209
|
id="select-button"
|
@@ -199,7 +211,7 @@ const c = class c extends b {
|
|
199
211
|
>
|
200
212
|
<span
|
201
213
|
id="selected-value"
|
202
|
-
class=${
|
214
|
+
class=${S({ "selected-value": !0, "contains-meta-info": !this.value })}>
|
203
215
|
${this._computeVisibleValue()}
|
204
216
|
</span>
|
205
217
|
<skf-icon class="arrow" name="chevronDown"></skf-icon>
|
@@ -213,15 +225,18 @@ const c = class c extends b {
|
|
213
225
|
${this.selectedOptions.map(
|
214
226
|
(t) => h`
|
215
227
|
<skf-tag
|
228
|
+
style="${`view-transition-name: tag-${String(t.textContent).replace(/[^a-zA-Z]/g, "").toLowerCase()}`}"
|
216
229
|
removable
|
217
|
-
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), t.removeAttribute("selected"),
|
230
|
+
.onRemove=${(e) => (e.stopPropagation(), e.preventDefault(), document.startViewTransition || t.removeAttribute("selected"), document.startViewTransition(() => {
|
231
|
+
t.removeAttribute("selected");
|
232
|
+
}), !1)}
|
218
233
|
>
|
219
234
|
${t.textContent}
|
220
235
|
</skf-tag>
|
221
236
|
`
|
222
237
|
)}
|
223
238
|
</div>
|
224
|
-
` :
|
239
|
+
` : V}
|
225
240
|
${this.hint && h`
|
226
241
|
<skf-hint
|
227
242
|
aria-live=${this._invalid ? "assertive" : "polite"}
|
@@ -236,77 +251,77 @@ const c = class c extends b {
|
|
236
251
|
`;
|
237
252
|
}
|
238
253
|
};
|
239
|
-
c.styles = [
|
240
|
-
let
|
254
|
+
c.styles = [$, P];
|
255
|
+
let s = c;
|
241
256
|
l([
|
242
|
-
|
243
|
-
],
|
257
|
+
o({ type: String, reflect: !0, attribute: "button-label" })
|
258
|
+
], s.prototype, "buttonLabel", 2);
|
244
259
|
l([
|
245
|
-
|
246
|
-
],
|
260
|
+
o({ attribute: "custom-invalid" })
|
261
|
+
], s.prototype, "customInvalid", 2);
|
247
262
|
l([
|
248
|
-
|
249
|
-
],
|
263
|
+
o({ type: Boolean, attribute: "hide-label" })
|
264
|
+
], s.prototype, "hideLabel", 2);
|
250
265
|
l([
|
251
|
-
|
252
|
-
],
|
266
|
+
o({ type: Boolean, reflect: !0, attribute: "hide-tags" })
|
267
|
+
], s.prototype, "hideTags", 2);
|
253
268
|
l([
|
254
|
-
|
255
|
-
],
|
269
|
+
o()
|
270
|
+
], s.prototype, "hint", 2);
|
256
271
|
l([
|
257
|
-
|
258
|
-
],
|
272
|
+
o({ type: Array, attribute: !1 })
|
273
|
+
], s.prototype, "selectedValues", 1);
|
259
274
|
l([
|
260
|
-
|
261
|
-
],
|
275
|
+
o({ type: Array, attribute: !1 })
|
276
|
+
], s.prototype, "selectedOptionsText", 1);
|
262
277
|
l([
|
263
|
-
|
264
|
-
],
|
278
|
+
o({ reflect: !0 })
|
279
|
+
], s.prototype, "label", 2);
|
265
280
|
l([
|
266
|
-
|
267
|
-
],
|
281
|
+
o({ type: Number })
|
282
|
+
], s.prototype, "max", 2);
|
268
283
|
l([
|
269
|
-
|
270
|
-
],
|
284
|
+
o({ type: Number })
|
285
|
+
], s.prototype, "min", 2);
|
271
286
|
l([
|
272
|
-
|
273
|
-
],
|
287
|
+
o({ type: Boolean, reflect: !0 })
|
288
|
+
], s.prototype, "multiple", 2);
|
274
289
|
l([
|
275
|
-
|
276
|
-
],
|
290
|
+
o()
|
291
|
+
], s.prototype, "name", 2);
|
277
292
|
l([
|
278
|
-
|
279
|
-
],
|
293
|
+
o({ attribute: "required-label" })
|
294
|
+
], s.prototype, "requiredLabel", 2);
|
280
295
|
l([
|
281
|
-
|
282
|
-
],
|
296
|
+
o()
|
297
|
+
], s.prototype, "severity", 2);
|
283
298
|
l([
|
284
|
-
|
285
|
-
],
|
299
|
+
o({ type: Boolean, attribute: "show-valid" })
|
300
|
+
], s.prototype, "showValid", 2);
|
286
301
|
l([
|
287
|
-
|
288
|
-
],
|
302
|
+
o({ reflect: !0 })
|
303
|
+
], s.prototype, "size", 2);
|
289
304
|
l([
|
290
305
|
d()
|
291
|
-
],
|
306
|
+
], s.prototype, "value", 1);
|
292
307
|
l([
|
293
308
|
d()
|
294
|
-
],
|
309
|
+
], s.prototype, "selectedOptions", 1);
|
295
310
|
l([
|
296
311
|
d()
|
297
|
-
],
|
312
|
+
], s.prototype, "_expanded", 2);
|
298
313
|
l([
|
299
314
|
d()
|
300
|
-
],
|
315
|
+
], s.prototype, "_invalid", 2);
|
301
316
|
l([
|
302
317
|
p("#select-button")
|
303
|
-
],
|
318
|
+
], s.prototype, "$selectBtn", 2);
|
304
319
|
l([
|
305
320
|
p("#selected-value")
|
306
|
-
],
|
321
|
+
], s.prototype, "$selectedValue", 2);
|
307
322
|
l([
|
308
323
|
p("#select-dropdown")
|
309
|
-
],
|
324
|
+
], s.prototype, "$dropdown", 2);
|
310
325
|
export {
|
311
|
-
|
326
|
+
s as SkfSelect
|
312
327
|
};
|
@@ -146,11 +146,14 @@ class _ {
|
|
146
146
|
}
|
147
147
|
_badAttributeCombinationWarning() {
|
148
148
|
r({
|
149
|
-
assert: (this.host.min ?? 0)
|
149
|
+
assert: (this.host.min ?? 0) <= (this.host.max ?? 1 / 0),
|
150
150
|
reason: "attribute-mismatch",
|
151
151
|
replaceStrings: [this.host.localName, "min", "smaller than max"]
|
152
152
|
}), r({
|
153
|
-
assert: (
|
153
|
+
assert: (
|
154
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
155
|
+
(this.host.min || this.host.max) && this.host.multiple || !(this.host.min && this.host.max)
|
156
|
+
),
|
154
157
|
reason: "attribute-mismatch",
|
155
158
|
replaceStrings: [this.host.localName, "min or max", "together with multiple"]
|
156
159
|
}), r({
|
@@ -41,7 +41,10 @@ const h = class h extends o {
|
|
41
41
|
var e;
|
42
42
|
if (this._invalid = !1, this.required && !this.checked) {
|
43
43
|
this.pristine || (this._invalid = !0);
|
44
|
-
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
44
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
45
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
46
|
+
((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
|
47
|
+
);
|
45
48
|
this.setValidity({ valueMissing: !0 }, String(a));
|
46
49
|
} else
|
47
50
|
this.setValidity({});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { SkfTabGroup } from '@components/tab-group/tab-group.component.js';
|
2
|
+
import { SkfElement } from '@internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
export interface SkfTabEvent {
|
5
|
+
tab: SkfTab;
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* The `<skf-tab>` is a component that displays a list of actions or options
|
9
|
+
*
|
10
|
+
* @event {CustomEvent} skf-tab-select - {detail: { selected: true, tab: SkfTab }} Fires when the tab is selected
|
11
|
+
* @event click - Fired when the component is clicked
|
12
|
+
*
|
13
|
+
* @slot - The tab's label
|
14
|
+
*
|
15
|
+
* @tagname skf-tab
|
16
|
+
*/
|
17
|
+
export declare class SkfTab extends SkfElement {
|
18
|
+
static styles: CSSResultGroup;
|
19
|
+
/** The name of the tab-panel this tab is associated with. The panel must be located in the same tab group. */
|
20
|
+
panel: string;
|
21
|
+
selected: boolean;
|
22
|
+
variant: SkfTabGroup['variant'];
|
23
|
+
constructor();
|
24
|
+
/** @internal */
|
25
|
+
handleSelectedChange(): void;
|
26
|
+
/** @internal */
|
27
|
+
private _handleClick;
|
28
|
+
render(): import("lit").TemplateResult<1>;
|
29
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { SkfElement as n } from "../../internal/components/skf-element.js";
|
2
|
+
import { watch as h } from "../../internal/helpers/watch.js";
|
3
|
+
import m from "../../styles/component.styles.js";
|
4
|
+
import { html as f } from "lit";
|
5
|
+
import { property as v, state as d } from "lit/decorators.js";
|
6
|
+
import { classMap as b } from "lit/directives/class-map.js";
|
7
|
+
import { styles as _ } from "./tab.styles.js";
|
8
|
+
var u = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (c, s, l, r) => {
|
9
|
+
for (var e = r > 1 ? void 0 : r ? y(s, l) : s, i = c.length - 1, o; i >= 0; i--)
|
10
|
+
(o = c[i]) && (e = (r ? o(s, l, e) : o(e)) || e);
|
11
|
+
return r && e && u(s, l, e), e;
|
12
|
+
};
|
13
|
+
const p = class p extends n {
|
14
|
+
constructor() {
|
15
|
+
super(), this.panel = "", this.selected = !1, this.variant = "expanded", this._handleClick = () => {
|
16
|
+
this.emit("skf-tab-select", {
|
17
|
+
detail: {
|
18
|
+
tab: this
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}, this.role = "tab", this.addEventListener("click", this._handleClick);
|
22
|
+
}
|
23
|
+
handleSelectedChange() {
|
24
|
+
this.ariaSelected = this.selected ? "true" : "false", this.tabIndex = this.selected ? 0 : -1;
|
25
|
+
}
|
26
|
+
render() {
|
27
|
+
return f`
|
28
|
+
<div
|
29
|
+
class=${b({
|
30
|
+
tab: !0,
|
31
|
+
"tab--expanded": this.variant === "expanded",
|
32
|
+
"tab--compressed": this.variant === "compressed",
|
33
|
+
"tab--selected": this.selected
|
34
|
+
})}
|
35
|
+
>
|
36
|
+
<slot class="tab__label"></slot>
|
37
|
+
</div>
|
38
|
+
`;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
p.styles = [m, _];
|
42
|
+
let t = p;
|
43
|
+
a([
|
44
|
+
v({ reflect: !0 })
|
45
|
+
], t.prototype, "panel", 2);
|
46
|
+
a([
|
47
|
+
d()
|
48
|
+
], t.prototype, "selected", 2);
|
49
|
+
a([
|
50
|
+
d()
|
51
|
+
], t.prototype, "variant", 2);
|
52
|
+
a([
|
53
|
+
h("selected")
|
54
|
+
], t.prototype, "handleSelectedChange", 1);
|
55
|
+
export {
|
56
|
+
t as SkfTab
|
57
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import { css as o } from "lit";
|
2
|
+
const e = o`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
4
|
+
@layer components {
|
5
|
+
:host {
|
6
|
+
contain: layout;
|
7
|
+
min-width: 0; /* Needed for truncation */
|
8
|
+
outline: transparent;
|
9
|
+
}
|
10
|
+
|
11
|
+
.tab {
|
12
|
+
color: var(--_skf-tab-color, var(--skf-text-color-primary));
|
13
|
+
cursor: pointer;
|
14
|
+
position: relative;
|
15
|
+
|
16
|
+
/* Indicator */
|
17
|
+
&::after {
|
18
|
+
background-color: var(--skf-color-brand-base);
|
19
|
+
block-size: 3px;
|
20
|
+
content: '';
|
21
|
+
inset-inline: 50%;
|
22
|
+
opacity: 0;
|
23
|
+
position: absolute;
|
24
|
+
transition: all calc(var(--skf-motion-duration-fast) * 1ms) var(--skf-motion-easing-ease-in);
|
25
|
+
}
|
26
|
+
|
27
|
+
:host(:focus-visible) & {
|
28
|
+
outline: var(--skf-border-width-md) solid var(--skf-color-brand-base);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
.tab--selected::after {
|
33
|
+
inset-inline: 0;
|
34
|
+
opacity: 1;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Compressed
|
39
|
+
*/
|
40
|
+
.tab--compressed {
|
41
|
+
padding-block-end: var(--skf-spacing-25);
|
42
|
+
|
43
|
+
/* Invisible bold label copy, to avoid layout shifts when selected */
|
44
|
+
&::before {
|
45
|
+
block-size: 0;
|
46
|
+
content: attr(data-label);
|
47
|
+
display: block;
|
48
|
+
font-weight: var(--skf-font-weight-bold);
|
49
|
+
visibility: hidden;
|
50
|
+
}
|
51
|
+
|
52
|
+
&::after {
|
53
|
+
inset-block-end: 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
&:hover,
|
57
|
+
&:active {
|
58
|
+
&::after {
|
59
|
+
inset-inline: 0;
|
60
|
+
opacity: 1;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
:host(:focus-visible) & {
|
65
|
+
outline-offset: 2px;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Expanded
|
71
|
+
*/
|
72
|
+
.tab--expanded {
|
73
|
+
align-items: center;
|
74
|
+
background-color: var(--_skf-tab-bg-color, var(--skf-color-neutral-lightest));
|
75
|
+
block-size: var(--skf-size-44);
|
76
|
+
border-block-end: var(--skf-border-width-sm) solid
|
77
|
+
var(--_skf-tab-border-bottom-color, var(--skf-border-color-tertiary));
|
78
|
+
display: flex;
|
79
|
+
justify-content: center;
|
80
|
+
padding-inline: var(--skf-spacing-50);
|
81
|
+
transition: background-color calc(var(--skf-motion-duration-fast) * 1ms)
|
82
|
+
var(--skf-motion-easing-ease-in);
|
83
|
+
|
84
|
+
&::after {
|
85
|
+
inset-block-start: 0;
|
86
|
+
}
|
87
|
+
|
88
|
+
&:hover {
|
89
|
+
--_skf-tab-bg-color: var(--skf-color-blue-lighest);
|
90
|
+
}
|
91
|
+
|
92
|
+
:host(:focus-visible) & {
|
93
|
+
outline-offset: -2px;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
.tab--expanded.tab--selected {
|
98
|
+
--_skf-tab-bg-color: var(--skf-bg-color-neutral-1);
|
99
|
+
--_skf-tab-border-bottom-color: transparent;
|
100
|
+
--_skf-tab-color: var(--skf-text-color-emphasised);
|
101
|
+
|
102
|
+
font-weight: var(--skf-font-weight-bold);
|
103
|
+
|
104
|
+
:host(:not(:first-of-type)) & {
|
105
|
+
border-inline-start: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
|
106
|
+
}
|
107
|
+
|
108
|
+
:host(:not(:last-of-type)) & {
|
109
|
+
border-inline-end: var(--skf-border-width-sm) solid var(--skf-border-color-tertiary);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
.tab__label {
|
114
|
+
display: block;
|
115
|
+
overflow-x: auto;
|
116
|
+
text-overflow: ellipsis;
|
117
|
+
white-space: nowrap;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
`;
|
121
|
+
export {
|
122
|
+
e as styles
|
123
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import '@components/card/card.js';
|
2
|
+
import { SkfElement } from '@internal/components/skf-element';
|
3
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
4
|
+
/**
|
5
|
+
* The `<skf-tab-group>` is a component that displays a list of actions or options.
|
6
|
+
*
|
7
|
+
* @documentation See [zeroheight](https://zeroheight.com/****) for design principles
|
8
|
+
*
|
9
|
+
* @slot - Used for grouping tab panels in the tab group. Must be <skf-tab-panel> elements
|
10
|
+
* @slot tabs - Used for grouping tabs in the tab group. Must be <skf-tab> elements
|
11
|
+
*
|
12
|
+
* @tagname skf-tab-group
|
13
|
+
*/
|
14
|
+
export declare class SkfTabGroup extends SkfElement {
|
15
|
+
static styles: CSSResultGroup;
|
16
|
+
/** Sets the default selected tab */
|
17
|
+
defaultSelected: number;
|
18
|
+
/** If true, removes border */
|
19
|
+
noBorder: boolean;
|
20
|
+
/** If true, removes padding */
|
21
|
+
noPadding: boolean;
|
22
|
+
/** If true, component fills the parent element height */
|
23
|
+
stretch: boolean;
|
24
|
+
/** Sets the appearance of the tabs */
|
25
|
+
variant: 'compressed' | 'expanded';
|
26
|
+
/** @internal */
|
27
|
+
private tabs;
|
28
|
+
/** @internal */
|
29
|
+
private panels;
|
30
|
+
firstUpdated(): void;
|
31
|
+
protected updated(_changedProperties: PropertyValues): void;
|
32
|
+
/** @internal */
|
33
|
+
private _getKeyDownNextTab;
|
34
|
+
/** @internal */
|
35
|
+
private _handleKeyDown;
|
36
|
+
/** @internal */
|
37
|
+
private _handleTabSelected;
|
38
|
+
/** @internal */
|
39
|
+
private _selectTab;
|
40
|
+
/** @internal */
|
41
|
+
private _syncTabsAndPanels;
|
42
|
+
render(): import("lit").TemplateResult<1>;
|
43
|
+
}
|