@skf-design-system/ui-components 1.0.0-beta.4 → 1.0.0-beta.7
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/dist/components/accordion/accordion-item.d.ts +1 -1
- package/dist/components/accordion/accordion.component.d.ts +13 -9
- package/dist/components/accordion/accordion.component.js +34 -30
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.styles.d.ts +1 -2
- package/dist/components/accordion/accordion.styles.js +5 -4
- package/dist/components/alert/alert.component.d.ts +10 -7
- package/dist/components/alert/alert.component.js +50 -37
- package/dist/components/alert/alert.styles.d.ts +1 -2
- package/dist/components/alert/alert.styles.js +42 -34
- package/dist/components/button/button.component.d.ts +28 -4
- package/dist/components/button/button.component.js +80 -56
- package/dist/components/button/button.styles.js +2 -1
- package/dist/components/card/card.component.d.ts +1 -1
- package/dist/components/card/card.component.js +29 -21
- package/dist/components/card/card.styles.d.ts +1 -2
- package/dist/components/card/card.styles.js +22 -12
- package/dist/components/checkbox/checkbox.component.d.ts +20 -18
- package/dist/components/checkbox/checkbox.component.js +95 -89
- package/dist/components/checkbox/checkbox.styles.js +7 -2
- package/dist/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/components/collapse/collapse.component.d.ts +8 -5
- package/dist/components/collapse/collapse.component.js +50 -39
- package/dist/components/collapse/collapse.styles.js +13 -12
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- package/dist/components/dialog/dialog.component.d.ts +75 -0
- package/dist/components/dialog/dialog.component.js +189 -0
- package/dist/components/dialog/dialog.d.ts +8 -0
- package/dist/components/dialog/dialog.js +6 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +91 -0
- package/dist/components/divider/divider.component.d.ts +14 -11
- package/dist/components/divider/divider.component.js +46 -29
- package/dist/components/divider/divider.styles.d.ts +1 -2
- package/dist/components/divider/divider.styles.js +26 -30
- package/dist/components/heading/heading.component.d.ts +14 -4
- package/dist/components/heading/heading.component.js +14 -14
- package/dist/components/heading/heading.styles.js +1 -1
- package/dist/components/icon/icon.component.d.ts +15 -9
- package/dist/components/icon/icon.component.js +6 -6
- package/dist/components/icon/icon.styles.js +56 -54
- package/dist/components/input/input.component.d.ts +48 -33
- package/dist/components/input/input.component.js +108 -99
- package/dist/components/link/link.component.d.ts +20 -17
- package/dist/components/link/link.component.js +20 -14
- package/dist/components/link/link.styles.js +36 -40
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +42 -61
- package/dist/components/loader/loader.styles.js +44 -11
- package/dist/components/logo/logo.component.d.ts +7 -5
- package/dist/components/logo/logo.component.js +25 -14
- package/dist/components/logo/logo.styles.d.ts +1 -2
- package/dist/components/logo/logo.styles.js +12 -10
- package/dist/components/progress/progress.component.d.ts +22 -0
- package/dist/components/progress/progress.component.js +49 -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 +48 -0
- package/dist/components/radio/radio.component.d.ts +21 -21
- package/dist/components/radio/radio.component.js +94 -78
- package/dist/components/radio/radio.styles.js +6 -1
- package/dist/components/select/select.component.d.ts +14 -12
- package/dist/components/select/select.component.js +119 -103
- package/dist/components/select/select.controllers.d.ts +1 -1
- package/dist/components/select/select.controllers.js +5 -2
- package/dist/components/select/select.styles.js +18 -3
- package/dist/components/select-option/select-option.component.d.ts +3 -3
- package/dist/components/select-option/select-option.component.js +16 -10
- package/dist/components/select-option/select-option.controllers.d.ts +1 -1
- package/dist/components/select-option-group/select-option-group.component.d.ts +1 -1
- package/dist/components/switch/switch.component.d.ts +4 -5
- package/dist/components/switch/switch.component.js +17 -7
- package/dist/components/switch/switch.styles.js +19 -11
- package/dist/components/switch/switch.test.d.ts +1 -0
- 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/tag/tag.component.d.ts +14 -9
- package/dist/components/tag/tag.component.js +63 -47
- package/dist/components/tag/tag.styles.js +35 -28
- package/dist/components/textarea/textarea.component.d.ts +30 -27
- package/dist/components/textarea/textarea.component.js +20 -17
- 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 +3090 -1993
- package/dist/index.d.ts +6 -0
- package/dist/index.js +60 -42
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -11
- package/dist/internal/components/hint/hint.component.d.ts +2 -2
- package/dist/internal/components/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/internal/components/skf-element.js +26 -25
- package/dist/internal/helpers/hintSeverity.d.ts +1 -1
- package/dist/internal/helpers/watch.d.ts +27 -0
- package/dist/internal/helpers/watch.js +28 -0
- package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -8
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +7 -6
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +10 -3
- package/dist/react/skf-button/index.d.ts +7 -1
- package/dist/react/skf-button/index.js +5 -1
- package/dist/react/skf-dialog/index.d.ts +15 -0
- package/dist/react/skf-dialog/index.js +19 -0
- 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/styles/component.styles.js +15 -2
- package/dist/styles/form-field.styles.js +5 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +300 -117
- package/dist/types/vue/index.d.ts +266 -76
- package/dist/vscode.html-custom-data.json +349 -216
- package/dist/web-types.json +686 -292
- package/package.json +33 -32
@@ -1,51 +1,51 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { FormBase as
|
2
|
+
import { FormBase as b } from "../../internal/components/formBase.js";
|
3
3
|
import "../../internal/components/hint/hint.js";
|
4
|
-
import { hintSeverity as
|
4
|
+
import { hintSeverity as v } from "../../internal/helpers/hintSeverity.js";
|
5
5
|
import { Asterisk as y } from "../../internal/templates/asterisk.js";
|
6
6
|
import f from "../../styles/component.styles.js";
|
7
7
|
import { html as h, nothing as d } from "lit";
|
8
|
-
import { property as
|
9
|
-
import { ifDefined as
|
10
|
-
import { live as
|
11
|
-
import { InputNumberController as
|
12
|
-
import
|
13
|
-
var
|
14
|
-
for (var o =
|
15
|
-
(u = m[l]) && (o = (
|
16
|
-
return
|
8
|
+
import { property as e, state as c, query as _, queryAssignedNodes as $ } from "lit/decorators.js";
|
9
|
+
import { ifDefined as n } from "lit/directives/if-defined.js";
|
10
|
+
import { live as g } from "lit/directives/live.js";
|
11
|
+
import { InputNumberController as w, InputPasswordController as E } from "./input.controllers.js";
|
12
|
+
import A from "./input.styles.js";
|
13
|
+
var C = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (m, s, r, a) => {
|
14
|
+
for (var o = a > 1 ? void 0 : a ? S(s, r) : s, l = m.length - 1, u; l >= 0; l--)
|
15
|
+
(u = m[l]) && (o = (a ? u(s, r, o) : u(o)) || o);
|
16
|
+
return a && o && C(s, r, o), o;
|
17
17
|
};
|
18
|
-
const p = class p extends
|
18
|
+
const p = class p extends b {
|
19
19
|
constructor() {
|
20
|
-
super(), this.buttonAriaLabelClear = "Clear input", this.buttonAriaLabelHide = "Hide password", this.buttonAriaLabelShow = "Show password", this.
|
20
|
+
super(...arguments), this.buttonAriaLabelClear = "Clear input", this.buttonAriaLabelHide = "Hide password", this.buttonAriaLabelShow = "Show password", this.inputmode = "text", this.size = "md", this.type = "text", this.validateOn = "change", this.value = "", this.invalid = !1, this._buttonDown = !1, this._numberController = new w(this), this._passwordController = new E(this), this._handleInput = () => {
|
21
21
|
this.value = this.$input.value || "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
22
|
-
}, this._resetValue = (
|
22
|
+
}, this._resetValue = (s) => {
|
23
23
|
var r;
|
24
|
-
|
25
|
-
}, this._handlePressStart = (
|
26
|
-
this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(
|
24
|
+
s.stopPropagation(), this.value = ((r = this.getAttribute("value")) == null ? void 0 : r.trim()) ?? "", this._internals.setFormValue(this.value), this.$input.focus();
|
25
|
+
}, this._handlePressStart = (s) => {
|
26
|
+
this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(s);
|
27
27
|
}, this._handlePressEnd = () => {
|
28
28
|
this._buttonDown = !1, this.type === "number" && this._numberController.handleActionBtnLongPressEnd();
|
29
|
-
}, this._renderNumberButton = (
|
29
|
+
}, this._renderNumberButton = (s) => h`
|
30
30
|
<button
|
31
31
|
?disabled=${this.disabled}
|
32
32
|
@click=${(r) => {
|
33
|
-
this._numberController.handleActionBtnClick(r,
|
33
|
+
this._numberController.handleActionBtnClick(r, s);
|
34
34
|
}}
|
35
35
|
@mousedown=${this._handlePressStart}
|
36
36
|
@mouseup=${this._handlePressEnd}
|
37
37
|
@mouseleave=${this._handlePressEnd}
|
38
|
-
aria-label="${
|
39
|
-
class="number"
|
38
|
+
aria-label="${s === "inc" ? "Increment" : "Decrement"}"
|
39
|
+
class="number skf-icon-host"
|
40
40
|
type="button"
|
41
41
|
>
|
42
|
-
<skf-icon name="${
|
42
|
+
<skf-icon name="${s === "inc" ? "chevronUp" : "chevronDown"}" size="sm"></skf-icon>
|
43
43
|
</button>
|
44
44
|
`, this._renderPasswordButton = () => h`
|
45
45
|
<button
|
46
46
|
@click=${this._passwordController.toggleVisibility}
|
47
|
-
aria-label=${
|
48
|
-
class="password"
|
47
|
+
aria-label=${n(this._passwordController._buttonAriaLabel)}
|
48
|
+
class="password skf-icon-host"
|
49
49
|
type="button"
|
50
50
|
@mousedown="${this._handlePressStart}"
|
51
51
|
@mouseup="${this._handlePressEnd}"
|
@@ -59,18 +59,18 @@ const p = class p extends v {
|
|
59
59
|
@mousedown=${this._handlePressStart}
|
60
60
|
@mouseup=${this._handlePressEnd}
|
61
61
|
@mouseleave=${this._handlePressEnd}
|
62
|
-
aria-label=${
|
63
|
-
class="search"
|
62
|
+
aria-label=${n(this.buttonAriaLabelClear)}
|
63
|
+
class="search skf-icon-host"
|
64
64
|
type="button"
|
65
65
|
>
|
66
66
|
<skf-icon name="close" size="sm"></skf-icon>
|
67
67
|
</button>
|
68
68
|
`, this._onBlur = () => {
|
69
69
|
this._buttonDown && this.$input.focus();
|
70
|
-
}
|
70
|
+
};
|
71
71
|
}
|
72
|
-
set customInvalid(
|
73
|
-
this.customError =
|
72
|
+
set customInvalid(s) {
|
73
|
+
this.customError = s || "";
|
74
74
|
}
|
75
75
|
get customInvalid() {
|
76
76
|
return this.customError;
|
@@ -78,12 +78,12 @@ const p = class p extends v {
|
|
78
78
|
firstUpdated() {
|
79
79
|
this.$input.addEventListener("change", () => {
|
80
80
|
this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input.value || ""), this.emitEvent("change"), this.validateInput();
|
81
|
-
}), this.addEventListener("invalid", (
|
82
|
-
this._pristine = !1, this.invalid = !0, this.customErrorDisplay &&
|
81
|
+
}), this.addEventListener("invalid", (s) => {
|
82
|
+
this._pristine = !1, this.invalid = !0, this.customErrorDisplay && s.preventDefault();
|
83
83
|
}), this.addEventListener("reset", this._resetValue), this.validateInput();
|
84
84
|
}
|
85
|
-
willUpdate(
|
86
|
-
if (
|
85
|
+
willUpdate(s) {
|
86
|
+
if (s.has("invalid"))
|
87
87
|
if (this.invalid) {
|
88
88
|
this.setAttribute("invalid", ""), this.showValid || this.removeAttribute("valid");
|
89
89
|
const r = this._internals.validationMessage;
|
@@ -91,10 +91,10 @@ const p = class p extends v {
|
|
91
91
|
} else
|
92
92
|
this.removeAttribute("invalid"), !this._pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
|
93
93
|
}
|
94
|
-
attributeChangedCallback(
|
95
|
-
if (super.attributeChangedCallback(
|
96
|
-
if (typeof
|
97
|
-
const l =
|
94
|
+
attributeChangedCallback(s, r, a) {
|
95
|
+
if (super.attributeChangedCallback(s, r, a), s === "value" && this._internals.setFormValue(a), s === "custom-invalid")
|
96
|
+
if (typeof a == "string") {
|
97
|
+
const l = this.withFallback(a);
|
98
98
|
this._pristine = !1, this._internals.setValidity({ customError: !0 }, l), this.invalid = !0, this.hint = l, this.checkValidity();
|
99
99
|
} else
|
100
100
|
this._internals.setValidity({}), this.validateInput();
|
@@ -107,67 +107,70 @@ const p = class p extends v {
|
|
107
107
|
this._internals.setValidity({ customError: this._internals.validity.customError });
|
108
108
|
else {
|
109
109
|
this.invalid = !this._pristine && !r.valid;
|
110
|
-
let
|
111
|
-
for (
|
112
|
-
const o = `data-${
|
113
|
-
if (r[
|
110
|
+
let a;
|
111
|
+
for (a in r) {
|
112
|
+
const o = `data-${a.toString()}`;
|
113
|
+
if (r[a] && !this.hasAttribute(o) && this.debug && console.log(
|
114
114
|
`Add custom message on ${this.localName} using attribute: ${o.toUpperCase()}="Your custom message"`
|
115
|
-
), r[
|
116
|
-
this.validationError =
|
115
|
+
), r[a]) {
|
116
|
+
this.validationError = a.toString();
|
117
117
|
const l = this.hasAttribute(o) ? this.getAttribute(o) : this.$input.validationMessage;
|
118
118
|
this._internals.setValidity(
|
119
119
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
120
|
-
l
|
120
|
+
this.withFallback(l)
|
121
121
|
), this.invalid && this.customErrorDisplay && this.checkValidity();
|
122
122
|
}
|
123
123
|
}
|
124
124
|
}
|
125
125
|
}
|
126
126
|
render() {
|
127
|
-
var
|
127
|
+
var r, a, o, l;
|
128
|
+
const s = (this._defaultSlot.length === 0 || !((a = (r = this._defaultSlot[0]) == null ? void 0 : r.textContent) != null && a.trim())) && !this.label;
|
128
129
|
return h`
|
129
|
-
<div id="
|
130
|
+
<div id="root">
|
130
131
|
<label>
|
131
|
-
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
132
|
+
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${s} id="label">
|
132
133
|
<slot>${this.label}</slot>
|
133
134
|
${this.required ? y(this.requiredLabel) : null}
|
134
135
|
</div>
|
135
136
|
<div id="input">
|
136
|
-
${this.type === "search" ? h`<skf-icon name="search" size="sm"></skf-icon>` : d}
|
137
|
+
${this.type === "search" ? h`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : d}
|
137
138
|
<div
|
138
|
-
data-leading=${
|
139
|
-
data-trailing=${
|
139
|
+
data-leading=${n(this.leading)}
|
140
|
+
data-trailing=${n(this.trailing)}
|
140
141
|
id="affix"
|
141
142
|
>
|
142
143
|
<input
|
143
|
-
autocomplete="off"
|
144
|
-
title=""
|
145
144
|
?disabled=${this.disabled}
|
146
145
|
?readonly=${this.readonly}
|
147
146
|
?required=${this.required}
|
148
|
-
.value=${
|
149
|
-
@input=${this._handleInput}
|
147
|
+
.value=${g(this.value)}
|
150
148
|
@blur=${this._onBlur}
|
151
|
-
|
152
|
-
|
149
|
+
@input=${this._handleInput}
|
150
|
+
autocomplete=${this.autocomplete}
|
151
|
+
aria-describedby=${n((o = this.hint) != null && o.trim() ? "hint" : d)}
|
152
|
+
aria-errormessage=${n((l = this.hint) != null && l.trim() ? "hint" : d)}
|
153
153
|
aria-invalid=${!!this.invalid}
|
154
|
+
autocomplete="off"
|
154
155
|
data-testid="field-input"
|
155
|
-
inputmode=${
|
156
|
-
max=${
|
157
|
-
maxlength=${
|
158
|
-
min=${
|
159
|
-
minlength=${
|
160
|
-
name=${
|
161
|
-
pattern=${
|
162
|
-
placeholder=${
|
163
|
-
type=${
|
156
|
+
inputmode=${n(this.inputMode)}
|
157
|
+
max=${n(this.max)}
|
158
|
+
maxlength=${n(this.maxLength)}
|
159
|
+
min=${n(this.min)}
|
160
|
+
minlength=${n(this.minLength)}
|
161
|
+
name=${n(this.name)}
|
162
|
+
pattern=${n(this.pattern)}
|
163
|
+
placeholder=${n(this.placeholder)}
|
164
|
+
type=${n(
|
164
165
|
this.type === "password" ? this._passwordController._type : this.type
|
165
166
|
)}
|
166
167
|
/>
|
167
168
|
</div>
|
168
|
-
${this.type === "number" ? h
|
169
|
-
|
170
|
-
|
169
|
+
${this.type === "number" ? h`
|
170
|
+
<div id="action">
|
171
|
+
${this._renderNumberButton("inc")} ${this._renderNumberButton("dec")}
|
172
|
+
</div>
|
173
|
+
` : d}
|
171
174
|
${this.type === "password" ? this._renderPasswordButton() : d}
|
172
175
|
${this.type === "search" && this.value.length > 0 ? this._renderSearchButton() : d}
|
173
176
|
</div>
|
@@ -176,103 +179,109 @@ const p = class p extends v {
|
|
176
179
|
<skf-hint
|
177
180
|
aria-live=${this.invalid ? "assertive" : "polite"}
|
178
181
|
id="hint"
|
179
|
-
severity=${
|
180
|
-
>${this.hint}
|
182
|
+
severity=${n(v(this.severity, this.invalid))}
|
183
|
+
>${this.customInvalid ? this.customInvalid : this.hint}
|
181
184
|
</skf-hint>
|
182
185
|
`}
|
183
186
|
</div>
|
184
187
|
`;
|
185
188
|
}
|
186
189
|
};
|
187
|
-
p.styles = [f,
|
190
|
+
p.styles = [f, A];
|
188
191
|
let t = p;
|
189
192
|
i([
|
190
|
-
|
193
|
+
e({ type: String })
|
194
|
+
], t.prototype, "autocomplete", 2);
|
195
|
+
i([
|
196
|
+
e({ attribute: "button-aria-label-clear" })
|
191
197
|
], t.prototype, "buttonAriaLabelClear", 2);
|
192
198
|
i([
|
193
|
-
|
199
|
+
e({ attribute: "button-aria-label-hide" })
|
194
200
|
], t.prototype, "buttonAriaLabelHide", 2);
|
195
201
|
i([
|
196
|
-
|
202
|
+
e({ attribute: "button-aria-label-show" })
|
197
203
|
], t.prototype, "buttonAriaLabelShow", 2);
|
198
204
|
i([
|
199
|
-
|
205
|
+
e({ attribute: "custom-invalid", reflect: !0 })
|
200
206
|
], t.prototype, "customInvalid", 1);
|
201
207
|
i([
|
202
|
-
|
208
|
+
e({ type: Boolean })
|
203
209
|
], t.prototype, "debug", 2);
|
204
210
|
i([
|
205
|
-
|
211
|
+
e({ type: Boolean, attribute: "hide-label" })
|
206
212
|
], t.prototype, "hideLabel", 2);
|
207
213
|
i([
|
208
|
-
|
214
|
+
e()
|
209
215
|
], t.prototype, "hint", 2);
|
210
216
|
i([
|
211
|
-
|
217
|
+
e({ type: String })
|
212
218
|
], t.prototype, "inputmode", 2);
|
213
219
|
i([
|
214
|
-
|
220
|
+
e()
|
215
221
|
], t.prototype, "label", 2);
|
216
222
|
i([
|
217
|
-
|
223
|
+
e()
|
218
224
|
], t.prototype, "leading", 2);
|
219
225
|
i([
|
220
|
-
|
226
|
+
e()
|
221
227
|
], t.prototype, "max", 2);
|
222
228
|
i([
|
223
|
-
|
229
|
+
e({ type: Number, attribute: "maxlength" })
|
224
230
|
], t.prototype, "maxLength", 2);
|
225
231
|
i([
|
226
|
-
|
232
|
+
e()
|
227
233
|
], t.prototype, "min", 2);
|
228
234
|
i([
|
229
|
-
|
235
|
+
e({ type: Number, attribute: "minlength" })
|
230
236
|
], t.prototype, "minLength", 2);
|
231
237
|
i([
|
232
|
-
|
238
|
+
e()
|
233
239
|
], t.prototype, "name", 2);
|
234
240
|
i([
|
235
|
-
|
241
|
+
e()
|
236
242
|
], t.prototype, "pattern", 2);
|
237
243
|
i([
|
238
|
-
|
244
|
+
e()
|
239
245
|
], t.prototype, "placeholder", 2);
|
240
246
|
i([
|
241
|
-
|
247
|
+
e({ type: Boolean })
|
242
248
|
], t.prototype, "readonly", 2);
|
243
249
|
i([
|
244
|
-
|
250
|
+
e({ attribute: "required-label" })
|
245
251
|
], t.prototype, "requiredLabel", 2);
|
246
252
|
i([
|
247
|
-
|
253
|
+
e({ reflect: !0 })
|
248
254
|
], t.prototype, "severity", 2);
|
249
255
|
i([
|
250
|
-
|
256
|
+
e({ type: Boolean, attribute: "show-valid" })
|
251
257
|
], t.prototype, "showValid", 2);
|
252
258
|
i([
|
253
|
-
|
259
|
+
e({ reflect: !0 })
|
254
260
|
], t.prototype, "size", 2);
|
255
261
|
i([
|
256
|
-
|
262
|
+
e()
|
257
263
|
], t.prototype, "trailing", 2);
|
258
264
|
i([
|
259
|
-
|
265
|
+
e()
|
260
266
|
], t.prototype, "type", 2);
|
261
267
|
i([
|
262
|
-
|
268
|
+
e({ type: String, attribute: "validate-on" })
|
263
269
|
], t.prototype, "validateOn", 2);
|
264
270
|
i([
|
265
|
-
|
271
|
+
e()
|
266
272
|
], t.prototype, "value", 2);
|
267
273
|
i([
|
268
|
-
|
274
|
+
c()
|
269
275
|
], t.prototype, "invalid", 2);
|
270
276
|
i([
|
271
|
-
|
277
|
+
c()
|
272
278
|
], t.prototype, "_buttonDown", 2);
|
273
279
|
i([
|
274
280
|
_("input")
|
275
281
|
], t.prototype, "$input", 2);
|
282
|
+
i([
|
283
|
+
$({ flatten: !0 })
|
284
|
+
], t.prototype, "_defaultSlot", 2);
|
276
285
|
export {
|
277
286
|
t as SkfInput
|
278
287
|
};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { SkfIcon } from '
|
2
|
-
import '
|
3
|
-
import { SkfElement } from '
|
1
|
+
import type { SkfIcon } from '../icon/icon.component.js';
|
2
|
+
import '../icon/icon.js';
|
3
|
+
import { SkfElement } from '../../internal/components/skf-element.js';
|
4
4
|
import { type CSSResultGroup } from 'lit';
|
5
5
|
/**
|
6
6
|
* The `<skf-link>` can be used as either a regular link or a link styled semantic button
|
@@ -9,38 +9,41 @@ import { type CSSResultGroup } from 'lit';
|
|
9
9
|
*
|
10
10
|
* @property {function} onClick - If provided, custom function triggered by click where the second return parameter enables custom routing.
|
11
11
|
*
|
12
|
-
* @slot
|
12
|
+
* @slot - The links' main content
|
13
13
|
*
|
14
14
|
* @tagname skf-link
|
15
15
|
*/
|
16
16
|
export declare class SkfLink extends SkfElement {
|
17
17
|
static styles: CSSResultGroup;
|
18
18
|
private _onClick?;
|
19
|
-
/**
|
19
|
+
/** Defines the semantic element to render */
|
20
20
|
as: 'button' | 'a';
|
21
|
-
/**
|
21
|
+
/** Defines the text-color */
|
22
22
|
color: 'primary' | 'inverse';
|
23
23
|
/** If true, disables the link */
|
24
24
|
disabled?: boolean;
|
25
|
-
/** If
|
25
|
+
/** If defined, downloads the url */
|
26
26
|
download?: string;
|
27
|
-
/** If
|
27
|
+
/** If defined, loads url on click */
|
28
28
|
href?: string;
|
29
|
-
/**
|
29
|
+
/**
|
30
|
+
* If defined, renders an icon before or after the text
|
31
|
+
* @type { "arrowDown" | "arrowDownUp" | "arrowLeft" | "arrowRight" | "arrowUp" | "article" | "artificialIntelligence" | "asset" | "attachment" | "bandCursor" | "bands" | "batteryEmpty" | "batteryFull" | "batteryLow" | "bearingFault" | "book" | "bulb" | "burger" | "cPM" | "calendar" | "calendarBooked" | "calendarEmpty" | "calendarNotBooked" | "calendarRecurring" | "caretDown" | "caretUp" | "caretUpDown" | "chat" | "check" | "checkCircle" | "checkSmall" | "chevronDown" | "chevronLeft" | "chevronRight" | "chevronUp" | "chevronUpDown" | "close" | "closeAllFaults" | "closeFault" | "closeSmall" | "columnGraph" | "comment" | "connection1" | "connection2" | "connection3" | "connection4" | "danger" | "defectFrequencies" | "defectFrequenciesAlternative" | "doubleChevronLeft" | "doubleChevronRight" | "download" | "draft" | "draftFilled" | "draftOutlined" | "dragNDrop" | "drop" | "duplicate" | "edit" | "emailFilled" | "emailOutlined" | "exclamation" | "eye" | "eyeHidden" | "eyeVisible" | "filter" | "forbidden" | "fullScreen" | "fullScreenExit" | "functionalLocation" | "harmonicCursor" | "heatmap" | "hierarchy" | "history" | "historyAlt" | "hourglassFramedFilled" | "hourglassFramedOutlined" | "hourglassOutlined" | "hz" | "iMX" | "image" | "infoCircleFilled" | "infoCircleOutlined" | "integration" | "kebab" | "link" | "listGroup" | "listItem" | "locationPin" | "lock" | "logOut" | "meatballs" | "microphone" | "minus" | "minusSmall" | "noData" | "o" | "openInNew" | "overlayBaseline" | "pDF" | "paper" | "pause" | "pieChart" | "pin" | "play" | "plus" | "powerOff" | "printer" | "proCollect" | "recAction" | "received" | "refresh" | "reorder" | "replace" | "reply" | "rewalkableRoute" | "routes" | "search" | "send" | "sensorA" | "sensorB" | "settings" | "sidebandCursor" | "singleCursor" | "spectrum" | "starFilled" | "starOutlined" | "statusCircle" | "stop" | "structuralVibration" | "sync" | "timewave" | "trash" | "trend" | "trendingUp" | "undo" | "unknownCircle" | "unknownDiamond" | "unlink" | "unlock" | "unscheduledAction" | "upload" | "user" | "viewFull" | "viewHorizontal" | "viewVertical" | "warning" | "warningCircle" | "warningDiamond" | "zoomIn" | "zoomOut" }
|
32
|
+
*/
|
30
33
|
icon?: SkfIcon['name'];
|
31
|
-
/**
|
34
|
+
/** Defines the position of the icon in relation to the text */
|
32
35
|
iconPlacement: 'left' | 'right';
|
33
|
-
/**
|
34
|
-
rel
|
35
|
-
/** If
|
36
|
+
/** If defined, describes the relationship between a linked resource and the current document */
|
37
|
+
rel?: string;
|
38
|
+
/** If defined, used on conjunction with onClick property, second argument */
|
36
39
|
route?: string;
|
37
40
|
/** If true, fills the parents horizontal axis */
|
38
|
-
stretch
|
39
|
-
/** If
|
41
|
+
stretch: boolean;
|
42
|
+
/** If defined, specifies where to open the linked document */
|
40
43
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
41
|
-
/**
|
44
|
+
/** Defines the type of button */
|
42
45
|
type: 'button' | 'submit' | 'reset';
|
43
|
-
/** If
|
46
|
+
/** If defined, accepts a function that runs on click. Forwards optional route as second argument. */
|
44
47
|
set onClick(onClickFn: ((event: Event, route?: string) => void) | undefined);
|
45
48
|
get onClick(): ((event: Event, route?: string) => void) | undefined;
|
46
49
|
connectedCallback(): void;
|
@@ -1,27 +1,28 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
2
|
import y from "./link.styles.js";
|
3
|
-
import { SkfElement as
|
3
|
+
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
4
4
|
import u from "../../styles/component.styles.js";
|
5
5
|
import "lit";
|
6
6
|
import { property as r } from "lit/decorators.js";
|
7
|
+
import { classMap as k } from "lit/directives/class-map.js";
|
7
8
|
import { ifDefined as n } from "lit/directives/if-defined.js";
|
8
|
-
import { html as f, literal as
|
9
|
-
var
|
10
|
-
for (var s =
|
11
|
-
(
|
12
|
-
return
|
9
|
+
import { html as f, literal as m } from "lit/static-html.js";
|
10
|
+
var v = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (h, t, i, c) => {
|
11
|
+
for (var s = c > 1 ? void 0 : c ? g(t, i) : t, l = h.length - 1, p; l >= 0; l--)
|
12
|
+
(p = h[l]) && (s = (c ? p(t, i, s) : p(s)) || s);
|
13
|
+
return c && s && v(t, i, s), s;
|
13
14
|
};
|
14
|
-
const a = class a extends
|
15
|
+
const a = class a extends d {
|
15
16
|
constructor() {
|
16
|
-
super(...arguments), this.as = "a", this.color = "primary", this.iconPlacement = "left", this.
|
17
|
+
super(...arguments), this.as = "a", this.color = "primary", this.iconPlacement = "left", this.stretch = !1, this.type = "button", this._preprocessOnClick = (t) => {
|
17
18
|
this.as === "a" && this.onClick && t.preventDefault(), t.stopPropagation(), this.emit("click");
|
18
19
|
};
|
19
20
|
}
|
20
21
|
set onClick(t) {
|
21
22
|
if (!t) return;
|
22
23
|
this._onClick = t;
|
23
|
-
const i = (
|
24
|
-
t(
|
24
|
+
const i = (c) => {
|
25
|
+
t(c, this.href ?? this.route);
|
25
26
|
};
|
26
27
|
this._assertValidOnClick(t), this.removeEventListener("click", i), this.addEventListener("click", i);
|
27
28
|
}
|
@@ -51,17 +52,22 @@ const a = class a extends m {
|
|
51
52
|
`;
|
52
53
|
}
|
53
54
|
render() {
|
54
|
-
const t = this.as === "a", i = t ?
|
55
|
+
const t = this.as === "a", i = t ? m`a` : m`button`;
|
55
56
|
return f`
|
56
57
|
<${i}
|
57
58
|
?disabled=${n(t ? void 0 : this.disabled)}
|
58
59
|
@click=${this._preprocessOnClick}
|
60
|
+
class=${k({
|
61
|
+
link: !0,
|
62
|
+
"link--color-inverse": this.color === "inverse",
|
63
|
+
"link--color-primary": this.color === "primary",
|
64
|
+
"link--icon-right": this.iconPlacement === "right",
|
65
|
+
"link--stretch": this.stretch
|
66
|
+
})}
|
59
67
|
download=${n(t ? this.download : void 0)}
|
60
68
|
href=${n(t ? this.href : void 0)}
|
61
|
-
id="link"
|
62
69
|
rel=${n(t ? this.rel : void 0)}
|
63
70
|
target=${n(t ? this.target : void 0)}
|
64
|
-
title=${this.title}
|
65
71
|
type=${n(t ? void 0 : this.type)}
|
66
72
|
>
|
67
73
|
${this.icon && this._renderIcon()}
|
@@ -85,7 +91,7 @@ o([
|
|
85
91
|
r({ type: String })
|
86
92
|
], e.prototype, "download", 2);
|
87
93
|
o([
|
88
|
-
r({ type: String
|
94
|
+
r({ type: String })
|
89
95
|
], e.prototype, "href", 2);
|
90
96
|
o([
|
91
97
|
r({ type: String })
|
@@ -1,36 +1,36 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
|
-
const
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
2
|
+
const o = r`
|
3
|
+
/* stylelint-disable selector-class-pattern */
|
4
|
+
@layer components {
|
5
|
+
.link {
|
6
|
+
align-items: center;
|
7
|
+
color: var(--state-color, var(--color));
|
8
|
+
display: inline-flex;
|
9
|
+
flex-direction: var(--flex-direction, rows);
|
10
|
+
font-weight: var(--skf-font-weight-bold);
|
11
|
+
gap: var(--skf-spacing-50);
|
12
|
+
justify-content: flex-start;
|
13
|
+
|
14
|
+
&:is(a) {
|
15
|
+
text-decoration: none;
|
16
|
+
}
|
17
|
+
|
18
|
+
&:disabled {
|
19
|
+
--state-color: var(--color-disabled);
|
20
|
+
}
|
21
|
+
|
22
|
+
&:hover {
|
23
|
+
--state-color: var(--color-hover);
|
24
|
+
}
|
25
|
+
|
26
|
+
&:focus-visible {
|
27
|
+
border-radius: var(--skf-border-radius-sm);
|
28
|
+
outline: var(--skf-border-width-md) solid var(--outline-color);
|
29
|
+
outline-offset: var(--skf-size-2);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
.link--color-primary {
|
34
34
|
--color: var(--skf-interactive-text-color-primary);
|
35
35
|
--color-active: var(--skf-interactive-text-color-primary-active);
|
36
36
|
--color-disabled: var(--skf-interactive-text-color-disabled);
|
@@ -38,7 +38,7 @@ const e = r`
|
|
38
38
|
--outline-color: var(--skf-interactive-text-color-primary);
|
39
39
|
}
|
40
40
|
|
41
|
-
|
41
|
+
.link--color-inverse {
|
42
42
|
--color: var(--skf-interactive-text-color-inverse);
|
43
43
|
--color-active: var(--skf-interactive-text-color-inverse-active);
|
44
44
|
--color-disabled: var(--skf-interactive-text-color-disabled);
|
@@ -46,19 +46,15 @@ const e = r`
|
|
46
46
|
--outline-color: var(--skf-interactive-text-color-inverse);
|
47
47
|
}
|
48
48
|
|
49
|
-
|
50
|
-
text-decoration: none;
|
51
|
-
}
|
52
|
-
|
53
|
-
:host([icon-placement='right']) & {
|
49
|
+
.link--icon-right {
|
54
50
|
--flex-direction: row-reverse;
|
55
51
|
}
|
56
52
|
|
57
|
-
|
53
|
+
.link--stretch {
|
58
54
|
inline-size: 100%;
|
59
55
|
}
|
60
56
|
}
|
61
57
|
`;
|
62
58
|
export {
|
63
|
-
|
59
|
+
o as default
|
64
60
|
};
|