@skf-design-system/ui-components 1.0.0-alpha.37 → 1.0.0-alpha.39
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 +18 -0
- package/dist/components/alert/alert.component.d.ts +3 -2
- package/dist/components/alert/alert.component.js +39 -33
- package/dist/components/breadcrumb/breadcrumb-item.component.js +11 -12
- package/dist/components/button/button.component.js +32 -36
- package/dist/components/button/button.styles.js +3 -3
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +1 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +107 -116
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +112 -100
- package/dist/components/datepicker/datepicker-popup.helpers.js +1 -1
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +159 -160
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +48 -48
- package/dist/components/divider/divider.component.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +12 -4
- package/dist/components/drawer/drawer.component.js +84 -61
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +64 -57
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/icon/icon.component.js +26 -16
- package/dist/components/icon/icon.styles.js +4 -4
- package/dist/components/input/input.component.d.ts +11 -10
- package/dist/components/input/input.component.js +115 -111
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +1 -0
- package/dist/components/link/link.component.js +86 -74
- package/dist/components/link/link.styles.js +7 -3
- package/dist/components/loader/loader.component.d.ts +0 -2
- package/dist/components/loader/loader.component.js +27 -30
- package/dist/components/loader/loader.styles.js +1 -1
- package/dist/components/menu/menu-item.styles.js +8 -7
- package/dist/components/menu/menu.component.d.ts +5 -2
- package/dist/components/menu/menu.component.js +8 -8
- package/dist/components/nav/nav.component.d.ts +3 -0
- package/dist/components/nav/nav.component.js +38 -33
- package/dist/components/popover/popover.component.d.ts +6 -7
- package/dist/components/popover/popover.component.js +23 -31
- package/dist/components/progress/progress.styles.js +3 -3
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +96 -91
- package/dist/components/radio/radio.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.component.js +1 -1
- package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/select/select-option.component.d.ts +2 -1
- package/dist/components/select/select-option.component.js +31 -36
- package/dist/components/select/select.component.d.ts +20 -10
- package/dist/components/select/select.component.js +139 -104
- package/dist/components/select/select.controllers.js +22 -20
- package/dist/components/select/select.styles.js +8 -2
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +26 -23
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tabs/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +19 -16
- package/dist/components/tabs/tab.component.d.ts +1 -1
- package/dist/components/tabs/tab.component.js +17 -14
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tabs/tabs.component.js +6 -6
- package/dist/components/tag/tag.component.d.ts +9 -6
- package/dist/components/tag/tag.component.js +78 -72
- package/dist/components/tag/tag.styles.js +5 -0
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +101 -95
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.singleton.js +6 -7
- package/dist/components/tooltip/tooltip.component.d.ts +7 -4
- package/dist/components/tooltip/tooltip.component.js +22 -14
- package/dist/custom-elements.json +835 -422
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +29 -9
- package/dist/internal/base-classes/popover/popover.base.js +79 -76
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.js +3 -3
- package/dist/internal/helpers/uuid.d.ts +8 -10
- package/dist/internal/helpers/uuid.js +4 -11
- package/dist/internal/helpers/watch.d.ts +1 -1
- package/dist/internal/templates/asterisk.d.ts +1 -1
- package/dist/internal/templates/asterisk.js +4 -4
- package/dist/internal/types.d.ts +4 -0
- package/dist/styles/global-alt.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +1840 -858
- package/dist/types/vue/index.d.ts +69 -64
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -83
- package/dist/web-types.json +229 -190
- package/package.json +29 -35
- package/custom-elements.json +0 -25490
@@ -1,52 +1,57 @@
|
|
1
|
-
var
|
2
|
-
throw TypeError(
|
1
|
+
var f = (t) => {
|
2
|
+
throw TypeError(t);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var u = (t, o, e) => o.has(t) || f("Cannot " + e);
|
5
|
+
var p = (t, o, e) => (u(t, o, "read from private field"), e ? e.call(t) : o.get(t)), m = (t, o, e) => o.has(t) ? f("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(t) : o.set(t, e), k = (t, o, e, s) => (u(t, o, "write to private field"), s ? s.call(t, e) : o.set(t, e), e);
|
6
6
|
import "../icon/icon.js";
|
7
|
-
import { SkfElement as
|
8
|
-
import { stateMap as
|
9
|
-
import { watch as
|
10
|
-
import { componentStyles as
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
import { SkfElement as g } from "../../internal/components/skf-element.js";
|
8
|
+
import { stateMap as w } from "../../internal/helpers/stateMap.js";
|
9
|
+
import { watch as $ } from "../../internal/helpers/watch.js";
|
10
|
+
import { componentStyles as z } from "../../styles/component.styles.js";
|
11
|
+
import { LocalizeController as R } from "../../utilities/localize.js";
|
12
|
+
import { nothing as y, html as v } from "lit";
|
13
|
+
import { property as h, query as D } from "lit/decorators.js";
|
14
|
+
import { ifDefined as E } from "lit/directives/if-defined.js";
|
15
|
+
import { styles as P } from "./tag.styles.js";
|
16
|
+
var S = Object.defineProperty, B = Object.getOwnPropertyDescriptor, l = (t, o, e, s) => {
|
17
|
+
for (var i = s > 1 ? void 0 : s ? B(o, e) : o, d = t.length - 1, b; d >= 0; d--)
|
18
|
+
(b = t[d]) && (i = (s ? b(o, e, i) : b(i)) || i);
|
19
|
+
return s && i && S(o, e, i), i;
|
19
20
|
};
|
20
|
-
const
|
21
|
+
const _ = {
|
21
22
|
size: ["sm", "md"],
|
22
23
|
color: ["error", "info", "success", "warning"]
|
23
24
|
};
|
24
|
-
var a,
|
25
|
-
const
|
25
|
+
var n, a, c;
|
26
|
+
const C = class C extends g {
|
26
27
|
constructor() {
|
27
28
|
super(...arguments);
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
m(this, n);
|
30
|
+
m(this, a);
|
31
|
+
m(this, c);
|
32
|
+
k(this, n, new R(this)), k(this, a, this.attachInternals()), k(this, c, p(this, a).states), this.size = "md", this.lang = "en", this.removable = !1, this._handleKeyDown = (e) => {
|
33
|
+
(e.key === "Enter" || e.key === " ") && this.$removeButton.click();
|
34
|
+
}, this._handleRemove = (e) => {
|
35
|
+
this._preRemoveCallback && this._preRemoveCallback(e);
|
36
|
+
}, this._handleClick = (e) => {
|
37
|
+
e.stopPropagation(), e.composedPath()[0].localName === "button" ? this.remove() : this.clickCallback?.(e);
|
37
38
|
};
|
38
39
|
}
|
39
|
-
|
40
|
-
|
40
|
+
/** If defined, accepts a function that runs on click */
|
41
|
+
// @property({ attribute: false })
|
42
|
+
set clickCallback(e) {
|
43
|
+
e && (this._clickCallback = e);
|
41
44
|
}
|
42
|
-
get
|
43
|
-
return this.
|
45
|
+
get clickCallback() {
|
46
|
+
return this._clickCallback;
|
44
47
|
}
|
45
|
-
|
46
|
-
|
48
|
+
/** If defined, accepts a function that runs on click. Self removal can be overridden by using `event.stopPropagation()`. */
|
49
|
+
// @property({ attribute: false })
|
50
|
+
set preRemoveCallback(e) {
|
51
|
+
e && (this._preRemoveCallback = e);
|
47
52
|
}
|
48
|
-
get
|
49
|
-
return this.
|
53
|
+
get preRemoveCallback() {
|
54
|
+
return this._preRemoveCallback;
|
50
55
|
}
|
51
56
|
connectedCallback() {
|
52
57
|
super.connectedCallback(), this.addEventListener("click", this._handleClick);
|
@@ -54,52 +59,53 @@ const u = class u extends _ {
|
|
54
59
|
disconnectedCallback() {
|
55
60
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
56
61
|
}
|
57
|
-
attributeChangedCallback(
|
58
|
-
super.attributeChangedCallback(
|
62
|
+
attributeChangedCallback(e, s, i) {
|
63
|
+
super.attributeChangedCallback(e, s, i), e === "removable" && i !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
|
59
64
|
}
|
60
|
-
_handleStateChange(
|
61
|
-
|
65
|
+
_handleStateChange(e, s, i) {
|
66
|
+
w(p(this, c), _[e]).set(i);
|
62
67
|
}
|
63
68
|
render() {
|
64
|
-
return
|
69
|
+
return v`
|
65
70
|
<div id="root">
|
66
|
-
${this.icon ?
|
71
|
+
${this.icon ? v`<skf-icon color=${E(this.color)} name=${this.icon} size="sm"></skf-icon>` : y}
|
67
72
|
<slot></slot>
|
68
|
-
${this.removable ?
|
69
|
-
<button
|
73
|
+
${this.removable ? v`
|
74
|
+
<button
|
75
|
+
@click=${this._handleRemove}
|
76
|
+
aria-label=${p(this, n).term("close")}
|
77
|
+
type="button"
|
78
|
+
>
|
70
79
|
<skf-icon name="close" size="xs"></skf-icon>
|
71
80
|
</button>
|
72
|
-
` :
|
81
|
+
` : y}
|
73
82
|
</div>
|
74
83
|
`;
|
75
84
|
}
|
76
85
|
};
|
77
|
-
a = new WeakMap(),
|
78
|
-
let
|
79
|
-
|
80
|
-
|
81
|
-
],
|
82
|
-
|
83
|
-
|
84
|
-
],
|
85
|
-
|
86
|
-
|
87
|
-
],
|
88
|
-
|
89
|
-
|
90
|
-
],
|
91
|
-
|
92
|
-
|
93
|
-
],
|
94
|
-
|
95
|
-
|
96
|
-
],
|
97
|
-
|
98
|
-
|
99
|
-
],
|
100
|
-
r([
|
101
|
-
w(Object.keys(b))
|
102
|
-
], n.prototype, "_handleStateChange", 1);
|
86
|
+
n = new WeakMap(), a = new WeakMap(), c = new WeakMap(), C.styles = [z, P];
|
87
|
+
let r = C;
|
88
|
+
l([
|
89
|
+
h({ type: String })
|
90
|
+
], r.prototype, "size", 2);
|
91
|
+
l([
|
92
|
+
h({ type: String })
|
93
|
+
], r.prototype, "icon", 2);
|
94
|
+
l([
|
95
|
+
h({ type: String })
|
96
|
+
], r.prototype, "color", 2);
|
97
|
+
l([
|
98
|
+
h({ type: String })
|
99
|
+
], r.prototype, "lang", 2);
|
100
|
+
l([
|
101
|
+
h({ type: Boolean })
|
102
|
+
], r.prototype, "removable", 2);
|
103
|
+
l([
|
104
|
+
D("button")
|
105
|
+
], r.prototype, "$removeButton", 2);
|
106
|
+
l([
|
107
|
+
$(Object.keys(_))
|
108
|
+
], r.prototype, "_handleStateChange", 1);
|
103
109
|
export {
|
104
|
-
|
110
|
+
r as SkfTag
|
105
111
|
};
|
@@ -41,6 +41,11 @@ const s = r`
|
|
41
41
|
border-radius: var(--skf-border-radius-sm);
|
42
42
|
outline: var(--skf-border-width-md) solid var(--skf-interactive-border-color-focus);
|
43
43
|
}
|
44
|
+
|
45
|
+
/* let button be first item in composedPath array */
|
46
|
+
& > * {
|
47
|
+
pointer-events: none;
|
48
|
+
}
|
44
49
|
}
|
45
50
|
}
|
46
51
|
|
@@ -3,6 +3,7 @@ import { FormBase } from '../../internal/components/formBase.js';
|
|
3
3
|
import '../../internal/components/hint/hint.js';
|
4
4
|
import type { FormFieldSeverity } from '../../internal/types.js';
|
5
5
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
6
|
+
import { type Language } from '../../utilities/localize.js';
|
6
7
|
import { type CSSResultGroup } from 'lit';
|
7
8
|
interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
|
8
9
|
cols?: number;
|
@@ -26,6 +27,7 @@ interface SkfTextAreaProps extends Omit<FormFieldBaseProps, 'type'> {
|
|
26
27
|
* @tagname skf-textarea
|
27
28
|
*/
|
28
29
|
export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
|
30
|
+
#private;
|
29
31
|
static styles: CSSResultGroup;
|
30
32
|
/** @internal */
|
31
33
|
private customError;
|
@@ -42,6 +44,8 @@ export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
|
|
42
44
|
hint?: string;
|
43
45
|
/** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
|
44
46
|
label?: string;
|
47
|
+
/** Sets the internal language of the component */
|
48
|
+
lang: Language;
|
45
49
|
/** If defined, adds name to the input-element */
|
46
50
|
name?: string;
|
47
51
|
/** If defined, sets the maximum character length to accept for this input */
|
@@ -52,8 +56,6 @@ export declare class SkfTextArea extends FormBase implements SkfTextAreaProps {
|
|
52
56
|
placeholder?: string;
|
53
57
|
/** If true, makes the element not mutable, meaning the user can not edit the control */
|
54
58
|
readonly: boolean;
|
55
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
56
|
-
requiredLabel?: string;
|
57
59
|
/** If defined, sets the rows of the textarea */
|
58
60
|
rows?: number;
|
59
61
|
/** If defined, displays provided severity state */
|
@@ -1,29 +1,36 @@
|
|
1
|
+
var m = (s) => {
|
2
|
+
throw TypeError(s);
|
3
|
+
};
|
4
|
+
var c = (s, r, t) => r.has(s) || m("Cannot " + t);
|
5
|
+
var y = (s, r, t) => (c(s, r, "read from private field"), t ? t.call(s) : r.get(s)), f = (s, r, t) => r.has(s) ? m("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, t), b = (s, r, t, o) => (c(s, r, "write to private field"), o ? o.call(s, t) : r.set(s, t), t);
|
1
6
|
import "../icon/icon.js";
|
2
|
-
import { FormBase as
|
7
|
+
import { FormBase as $ } from "../../internal/components/formBase.js";
|
3
8
|
import "../../internal/components/hint/hint.js";
|
4
|
-
import { hintSeverity as
|
5
|
-
import { Asterisk as
|
6
|
-
import { componentStyles as
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
import { hintSeverity as E } from "../../internal/helpers/hintSeverity.js";
|
10
|
+
import { Asterisk as _ } from "../../internal/templates/asterisk.js";
|
11
|
+
import { componentStyles as V } from "../../styles/component.styles.js";
|
12
|
+
import { LocalizeController as w } from "../../utilities/localize.js";
|
13
|
+
import { nothing as u, html as g } from "lit";
|
14
|
+
import { property as l, state as x, query as I } from "lit/decorators.js";
|
15
|
+
import { ifDefined as h } from "lit/directives/if-defined.js";
|
16
|
+
import L from "./textarea.styles.js";
|
17
|
+
var A = Object.defineProperty, O = Object.getOwnPropertyDescriptor, e = (s, r, t, o) => {
|
18
|
+
for (var a = o > 1 ? void 0 : o ? O(r, t) : r, n = s.length - 1, d; n >= 0; n--)
|
19
|
+
(d = s[n]) && (a = (o ? d(r, t, a) : d(a)) || a);
|
20
|
+
return o && a && A(r, t, a), a;
|
21
|
+
}, p;
|
22
|
+
const v = class v extends $ {
|
17
23
|
constructor() {
|
18
|
-
super(...arguments)
|
19
|
-
|
20
|
-
|
24
|
+
super(...arguments);
|
25
|
+
f(this, p);
|
26
|
+
b(this, p, new w(this)), this.debug = !1, this.hideLabel = !1, this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.validateOn = "change", this.value = "", this.invalid = !1, this._resetValue = (t) => {
|
27
|
+
t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._internals.setFormValue(this.value), this.$input.focus();
|
21
28
|
}, this._handleInput = () => {
|
22
29
|
this.value = this.$input.value || "", this.validateOn === "input" && (this.pristine = !1, this.validateInput());
|
23
30
|
};
|
24
31
|
}
|
25
|
-
set customInvalid(
|
26
|
-
this.customError =
|
32
|
+
set customInvalid(t) {
|
33
|
+
this.customError = t ?? "";
|
27
34
|
}
|
28
35
|
get customInvalid() {
|
29
36
|
return this.customError;
|
@@ -31,58 +38,57 @@ const d = class d extends m {
|
|
31
38
|
firstUpdated() {
|
32
39
|
this.$input.addEventListener("change", () => {
|
33
40
|
this.validateOn === "change" && (this.validateOn = "input", this.pristine = !1), this._internals.setFormValue(this.$input.value || ""), this.emitEvent("change"), this.validateInput();
|
34
|
-
}), this.addEventListener("invalid", (
|
35
|
-
this.pristine = !1, this.invalid = !0, this.customErrorDisplay &&
|
41
|
+
}), this.addEventListener("invalid", (t) => {
|
42
|
+
this.pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
|
36
43
|
}), this.addEventListener("reset", this._resetValue), this.validateInput();
|
37
44
|
}
|
38
|
-
willUpdate(
|
39
|
-
if (
|
45
|
+
willUpdate(t) {
|
46
|
+
if (t.has("invalid"))
|
40
47
|
if (this.invalid) {
|
41
48
|
this.setAttribute("invalid", ""), this.showValid || this.removeAttribute("valid");
|
42
|
-
const
|
43
|
-
this.hint =
|
49
|
+
const o = this._internals.validationMessage;
|
50
|
+
this.hint = o !== "" ? this._internals.validationMessage : "unspecified error", this.checkValidity();
|
44
51
|
} else
|
45
52
|
this.removeAttribute("invalid"), !this.pristine && this.showValid && this.setAttribute("valid", "true"), this.hint = this.getAttribute("hint") ?? "";
|
46
53
|
}
|
47
|
-
attributeChangedCallback(
|
48
|
-
if (super.attributeChangedCallback(
|
54
|
+
attributeChangedCallback(t, o, a) {
|
55
|
+
if (super.attributeChangedCallback(t, o, a), t === "value" && this._internals.setFormValue(a), t === "custom-invalid")
|
49
56
|
if (typeof a == "string") {
|
50
|
-
const
|
51
|
-
this.pristine = !1, this._internals.setValidity({ customError: !0 },
|
57
|
+
const d = this.withFallback(a);
|
58
|
+
this.pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
|
52
59
|
} else
|
53
60
|
this._internals.setValidity({}), this.validateInput();
|
54
61
|
}
|
55
62
|
/** @internal */
|
56
63
|
validateInput() {
|
57
64
|
if (this._internals.validity.customError) return;
|
58
|
-
const
|
59
|
-
if (this.invalid = !1,
|
65
|
+
const o = this.$input.validity;
|
66
|
+
if (this.invalid = !1, o.valid)
|
60
67
|
this._internals.setValidity({ customError: this._internals.validity.customError });
|
61
68
|
else {
|
62
|
-
this.invalid = !this.pristine && !
|
69
|
+
this.invalid = !this.pristine && !o.valid;
|
63
70
|
let a;
|
64
|
-
for (a in
|
65
|
-
const
|
66
|
-
if (
|
67
|
-
`Add custom message on ${this.localName} using attribute: ${
|
68
|
-
),
|
71
|
+
for (a in o) {
|
72
|
+
const n = `data-${a.toString()}`;
|
73
|
+
if (o[a] && !this.hasAttribute(n) && this.debug && console.log(
|
74
|
+
`Add custom message on ${this.localName} using attribute: ${n.toUpperCase()}="Your custom message"`
|
75
|
+
), o[a]) {
|
69
76
|
this.validationError = a.toString();
|
70
|
-
const
|
77
|
+
const d = this.hasAttribute(n) ? this.getAttribute(n) : this.$input.validationMessage;
|
71
78
|
this._internals.setValidity(
|
72
79
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
73
|
-
this.withFallback(
|
80
|
+
this.withFallback(d)
|
74
81
|
), this.invalid && this.customErrorDisplay && this.checkValidity();
|
75
82
|
}
|
76
83
|
}
|
77
84
|
}
|
78
85
|
}
|
79
86
|
render() {
|
80
|
-
|
81
|
-
return v`
|
87
|
+
return g`
|
82
88
|
<div id="root">
|
83
89
|
<label>
|
84
90
|
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
85
|
-
<slot>${this.label}</slot> ${this.required ? y(this.
|
91
|
+
<slot>${this.label}</slot> ${this.required ? _(y(this, p).term("required")) : u}
|
86
92
|
</div>
|
87
93
|
<div id="input">
|
88
94
|
<textarea
|
@@ -91,25 +97,25 @@ const d = class d extends m {
|
|
91
97
|
?required=${this.required}
|
92
98
|
.value=${this.value}
|
93
99
|
@input=${this._handleInput}
|
94
|
-
aria-describedby=${
|
95
|
-
aria-errormessage=${
|
100
|
+
aria-describedby=${h(this.hint?.trim() ? "hint" : u)}
|
101
|
+
aria-errormessage=${h(this.hint?.trim() ? "hint" : u)}
|
96
102
|
aria-invalid=${!!this.invalid}
|
97
|
-
cols=${
|
98
|
-
maxlength=${
|
99
|
-
minlength=${
|
100
|
-
name=${
|
101
|
-
placeholder=${
|
102
|
-
rows=${
|
103
|
+
cols=${h(this.cols)}
|
104
|
+
maxlength=${h(this.maxLength)}
|
105
|
+
minlength=${h(this.minLength)}
|
106
|
+
name=${h(this.name)}
|
107
|
+
placeholder=${h(this.placeholder)}
|
108
|
+
rows=${h(this.rows)}
|
103
109
|
>
|
104
110
|
</textarea>
|
105
111
|
</div>
|
106
112
|
</label>
|
107
|
-
${this.hint &&
|
113
|
+
${this.hint && g`
|
108
114
|
<skf-hint
|
109
115
|
?disabled=${this.disabled}
|
110
116
|
aria-live=${this.invalid ? "assertive" : "polite"}
|
111
117
|
id="hint"
|
112
|
-
severity=${
|
118
|
+
severity=${h(E(this.invalid, this.severity))}
|
113
119
|
>
|
114
120
|
${this.customInvalid ?? this.hint}
|
115
121
|
</skf-hint>
|
@@ -118,68 +124,68 @@ const d = class d extends m {
|
|
118
124
|
`;
|
119
125
|
}
|
120
126
|
};
|
121
|
-
|
122
|
-
let
|
127
|
+
p = new WeakMap(), v.styles = [V, L];
|
128
|
+
let i = v;
|
123
129
|
e([
|
124
|
-
|
125
|
-
],
|
130
|
+
l({ type: Number })
|
131
|
+
], i.prototype, "cols", 2);
|
126
132
|
e([
|
127
|
-
|
128
|
-
],
|
133
|
+
l({ attribute: "custom-invalid", reflect: !0 })
|
134
|
+
], i.prototype, "customInvalid", 1);
|
129
135
|
e([
|
130
|
-
|
131
|
-
],
|
136
|
+
l({ type: Boolean })
|
137
|
+
], i.prototype, "debug", 2);
|
132
138
|
e([
|
133
|
-
|
134
|
-
],
|
139
|
+
l({ type: Boolean, attribute: "hide-label" })
|
140
|
+
], i.prototype, "hideLabel", 2);
|
135
141
|
e([
|
136
|
-
|
137
|
-
],
|
142
|
+
l()
|
143
|
+
], i.prototype, "hint", 2);
|
138
144
|
e([
|
139
|
-
|
140
|
-
],
|
145
|
+
l()
|
146
|
+
], i.prototype, "label", 2);
|
141
147
|
e([
|
142
|
-
|
143
|
-
],
|
148
|
+
l({ type: String })
|
149
|
+
], i.prototype, "lang", 2);
|
144
150
|
e([
|
145
|
-
|
146
|
-
],
|
151
|
+
l()
|
152
|
+
], i.prototype, "name", 2);
|
147
153
|
e([
|
148
|
-
|
149
|
-
],
|
154
|
+
l({ type: Number, attribute: "maxlength" })
|
155
|
+
], i.prototype, "maxLength", 2);
|
150
156
|
e([
|
151
|
-
|
152
|
-
],
|
157
|
+
l({ type: Number, attribute: "minlength" })
|
158
|
+
], i.prototype, "minLength", 2);
|
153
159
|
e([
|
154
|
-
|
155
|
-
],
|
160
|
+
l()
|
161
|
+
], i.prototype, "placeholder", 2);
|
156
162
|
e([
|
157
|
-
|
158
|
-
],
|
163
|
+
l({ type: Boolean })
|
164
|
+
], i.prototype, "readonly", 2);
|
159
165
|
e([
|
160
|
-
|
161
|
-
],
|
166
|
+
l({ type: Number })
|
167
|
+
], i.prototype, "rows", 2);
|
162
168
|
e([
|
163
|
-
|
164
|
-
],
|
169
|
+
l()
|
170
|
+
], i.prototype, "severity", 2);
|
165
171
|
e([
|
166
|
-
|
167
|
-
],
|
172
|
+
l({ type: Boolean, attribute: "show-valid" })
|
173
|
+
], i.prototype, "showValid", 2);
|
168
174
|
e([
|
169
|
-
|
170
|
-
],
|
175
|
+
l({ reflect: !0 })
|
176
|
+
], i.prototype, "size", 2);
|
171
177
|
e([
|
172
|
-
|
173
|
-
],
|
178
|
+
l({ attribute: "validate-on" })
|
179
|
+
], i.prototype, "validateOn", 2);
|
174
180
|
e([
|
175
|
-
|
176
|
-
],
|
181
|
+
l()
|
182
|
+
], i.prototype, "value", 2);
|
177
183
|
e([
|
178
|
-
|
179
|
-
],
|
184
|
+
x()
|
185
|
+
], i.prototype, "invalid", 2);
|
180
186
|
e([
|
181
|
-
|
182
|
-
],
|
187
|
+
I("textarea")
|
188
|
+
], i.prototype, "$input", 2);
|
183
189
|
export {
|
184
|
-
|
190
|
+
i as SkfTextArea
|
185
191
|
};
|
@@ -1,18 +1,21 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
|
-
const
|
2
|
+
const e = o`
|
3
3
|
@layer components {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
@layer overrides {
|
5
|
+
:host {
|
6
|
+
overflow: hidden; /* Enable mask transition */
|
7
|
+
padding-block-end: 3px; /* Make room for box-shadow */
|
8
|
+
}
|
9
|
+
|
10
|
+
#root {
|
11
|
+
--_skf-alert-bg-color: var(--skf-bg-color-neutral-1);
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
13
|
+
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
|
14
|
+
border-inline-start: var(--skf-size-8) solid var(--_skf-alert-border-color);
|
15
|
+
}
|
13
16
|
}
|
14
17
|
}
|
15
18
|
`;
|
16
19
|
export {
|
17
|
-
|
20
|
+
e as default
|
18
21
|
};
|
@@ -22,9 +22,9 @@ class s {
|
|
22
22
|
this.data = [...this.data, o], this.udpateUI();
|
23
23
|
}
|
24
24
|
udpateUI() {
|
25
|
-
const o =
|
26
|
-
this.usePopover && o.showPopover(),
|
27
|
-
function
|
25
|
+
const o = p(this.root, this.usePopover);
|
26
|
+
this.usePopover && o.showPopover(), n();
|
27
|
+
function n() {
|
28
28
|
const i = new s();
|
29
29
|
for (; i.hasToasts(); ) {
|
30
30
|
const t = i.popToast();
|
@@ -36,10 +36,9 @@ class s {
|
|
36
36
|
a.classList.add("toast-item-wrapper"), a.appendChild(e), o.prepend(a);
|
37
37
|
}
|
38
38
|
}
|
39
|
-
function
|
40
|
-
|
41
|
-
|
42
|
-
let r = n == null ? void 0 : n.querySelector("skf-toast-wrapper");
|
39
|
+
function p(i, t) {
|
40
|
+
const a = new s().getData()[0]?.topOffset ?? null;
|
41
|
+
let r = i.querySelector("body")?.querySelector("skf-toast-wrapper");
|
43
42
|
if (!r) {
|
44
43
|
if (r = document.createElement("skf-toast-wrapper"), !r) throw new Error("Could not create toast wrapper element");
|
45
44
|
t && r.setAttribute("popover", "auto"), a && r.setAttribute("top-offset", a.toString()), document.body.appendChild(r);
|
@@ -8,8 +8,11 @@ import type { CSSResultGroup } from 'lit';
|
|
8
8
|
* @attribute {"top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end"} [placement='bottom-start'] - The placement of the dropdown
|
9
9
|
* @attribute {string} [anchor] - The id of the element the dropdown will be anchored to
|
10
10
|
*
|
11
|
-
* @
|
12
|
-
* @
|
11
|
+
* @property {(void) => void} open() - Method that opens the tooltip
|
12
|
+
* @property {(void) => void} close() - Method that closes the tooltip
|
13
|
+
*
|
14
|
+
* @event {CustomEvent} skf-opened - Fired when the tooltip is opened
|
15
|
+
* @event {CustomEvent} skf-closed - Fired when the tooltip is closed
|
13
16
|
*
|
14
17
|
* @slot - The tooltip popover content
|
15
18
|
*
|
@@ -18,7 +21,7 @@ import type { CSSResultGroup } from 'lit';
|
|
18
21
|
export declare class SkfTooltip extends SkfPopoverBase {
|
19
22
|
static styles: CSSResultGroup;
|
20
23
|
constructor();
|
21
|
-
|
22
|
-
|
24
|
+
connectedCallback(): void;
|
25
|
+
/** @internal */
|
23
26
|
addEventListeners($element: HTMLElement | Element): void;
|
24
27
|
}
|