@skf-design-system/ui-components 1.0.2-beta.6 → 1.0.2-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 +18 -0
- package/dist/components/alert/alert.component.d.ts +3 -2
- package/dist/components/alert/alert.component.js +39 -33
- package/dist/components/button/button.styles.js +3 -3
- package/dist/components/checkbox/checkbox.component.d.ts +4 -2
- package/dist/components/checkbox/checkbox.component.js +73 -65
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/datepicker/datepicker-calendar.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-calendar.component.js +134 -127
- package/dist/components/datepicker/datepicker-popup.component.d.ts +4 -0
- package/dist/components/datepicker/datepicker-popup.component.js +100 -88
- package/dist/components/datepicker/datepicker.component.d.ts +4 -2
- package/dist/components/datepicker/datepicker.component.js +150 -140
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +39 -37
- package/dist/components/divider/divider.component.js +13 -13
- package/dist/components/divider/divider.styles.js +2 -2
- package/dist/components/drawer/drawer.component.d.ts +3 -2
- package/dist/components/drawer/drawer.component.js +37 -35
- package/dist/components/drawer/drawer.styles.js +1 -1
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +66 -57
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/icon/icon.component.js +7 -7
- package/dist/components/icon/icon.styles.js +2 -2
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +146 -147
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +12 -12
- package/dist/components/link/link.component.js +19 -12
- package/dist/components/link/link.styles.js +11 -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 +4 -1
- 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 -3
- 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 +91 -83
- 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/select/select-option.component.d.ts +2 -2
- package/dist/components/select/select-option.component.js +16 -19
- package/dist/components/select/select.component.d.ts +13 -9
- package/dist/components/select/select.component.js +169 -144
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -56
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/tag/tag.component.d.ts +3 -0
- package/dist/components/tag/tag.component.js +50 -41
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +126 -118
- package/dist/components/tooltip/tooltip.component.d.ts +8 -2
- package/dist/components/tooltip/tooltip.component.js +3 -0
- package/dist/custom-elements.json +569 -309
- package/dist/internal/base-classes/popover/popover.base.d.ts +21 -2
- package/dist/internal/base-classes/popover/popover.base.js +10 -12
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- 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/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 +59 -47
- package/dist/types/vue/index.d.ts +59 -47
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +75 -80
- package/dist/web-types.json +201 -166
- package/package.json +26 -33
- package/custom-elements.json +0 -25490
@@ -1,21 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { componentStyles as p } from "../../styles/component.styles.js";
|
4
|
-
import { nothing as c, html as v } from "lit";
|
5
|
-
import { property as s, state as f, query as m } from "lit/decorators.js";
|
6
|
-
import { classMap as _ } from "lit/directives/class-map.js";
|
7
|
-
import { ifDefined as b } from "lit/directives/if-defined.js";
|
8
|
-
import { styles as y } from "./switch.styles.js";
|
9
|
-
var g = Object.defineProperty, i = (d, e, a, k) => {
|
10
|
-
for (var l = void 0, h = d.length - 1, n; h >= 0; h--)
|
11
|
-
(n = d[h]) && (l = n(e, a, l) || l);
|
12
|
-
return l && g(e, a, l), l;
|
1
|
+
var p = (t) => {
|
2
|
+
throw TypeError(t);
|
13
3
|
};
|
14
|
-
|
4
|
+
var c = (t, i, e) => i.has(t) || p("Cannot " + e);
|
5
|
+
var v = (t, i, e) => (c(t, i, "read from private field"), e ? e.call(t) : i.get(t)), f = (t, i, e) => i.has(t) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(t) : i.set(t, e), m = (t, i, e, l) => (c(t, i, "write to private field"), l ? l.call(t, e) : i.set(t, e), e);
|
6
|
+
import { FormBase as _ } from "../../internal/components/formBase.js";
|
7
|
+
import { Asterisk as y } from "../../internal/templates/asterisk.js";
|
8
|
+
import { componentStyles as b } from "../../styles/component.styles.js";
|
9
|
+
import { LocalizeController as g } from "../../utilities/localize.js";
|
10
|
+
import { nothing as k, html as $ } from "lit";
|
11
|
+
import { property as h, state as C, query as V } from "lit/decorators.js";
|
12
|
+
import { classMap as w } from "lit/directives/class-map.js";
|
13
|
+
import { ifDefined as q } from "lit/directives/if-defined.js";
|
14
|
+
import { styles as z } from "./switch.styles.js";
|
15
|
+
var A = Object.defineProperty, a = (t, i, e, l) => {
|
16
|
+
for (var r = void 0, d = t.length - 1, u; d >= 0; d--)
|
17
|
+
(u = t[d]) && (r = u(i, e, r) || r);
|
18
|
+
return r && A(i, e, r), r;
|
19
|
+
}, n;
|
20
|
+
const o = class o extends _ {
|
15
21
|
constructor() {
|
16
|
-
super(...arguments)
|
17
|
-
|
18
|
-
|
22
|
+
super(...arguments);
|
23
|
+
f(this, n);
|
24
|
+
m(this, n, new g(this)), this._initialChecked = !1, this.debug = !1, this.checked = !1, this.hideLabel = !1, this.lang = "en", this.size = "md", this.value = "", this._invalid = !1, this._handleChange = (e) => {
|
25
|
+
var l;
|
26
|
+
e.stopPropagation(), this.pristine = !1, this.checked = ((l = this.$input) == null ? void 0 : l.checked) ?? !1, this._validateInput(), this.checked ? this.setFormValue(this.value) : this.setFormValue(null), this.emitEvent("change");
|
19
27
|
}, this._handleInvalid = (e) => {
|
20
28
|
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && e.preventDefault();
|
21
29
|
}, this._resetValue = (e) => {
|
@@ -42,18 +50,18 @@ const r = class r extends o {
|
|
42
50
|
var e;
|
43
51
|
if (this._invalid = !1, this.required && !this.checked) {
|
44
52
|
this.pristine || (this._invalid = !0);
|
45
|
-
const
|
53
|
+
const l = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
46
54
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
47
55
|
((e = this.$input) == null ? void 0 : e.validationMessage) || "Please check this box if you want to proceed"
|
48
56
|
);
|
49
|
-
this.setValidity({ valueMissing: !0 }, String(
|
57
|
+
this.setValidity({ valueMissing: !0 }, String(l));
|
50
58
|
} else
|
51
59
|
this.setValidity({});
|
52
60
|
}
|
53
61
|
render() {
|
54
|
-
return
|
62
|
+
return $`
|
55
63
|
<label
|
56
|
-
class=${
|
64
|
+
class=${w({
|
57
65
|
switch: !0,
|
58
66
|
"switch--small": this.size === "sm"
|
59
67
|
})}
|
@@ -67,50 +75,50 @@ const r = class r extends o {
|
|
67
75
|
@reset=${this._resetValue}
|
68
76
|
aria-invalid=${!!this._invalid}
|
69
77
|
class="switch__input"
|
70
|
-
name=${
|
78
|
+
name=${q(this.name)}
|
71
79
|
type="checkbox"
|
72
80
|
value=${this.value}
|
73
81
|
/>
|
74
|
-
<div class="switch__label ${this.hideLabel ? "visually-hidden" :
|
82
|
+
<div class="switch__label ${this.hideLabel ? "visually-hidden" : k}">
|
75
83
|
<slot>${this.label}</slot>
|
76
|
-
${this.required ?
|
84
|
+
${this.required ? y(v(this, n).term("required"), "switch__asterisk") : null}
|
77
85
|
</div>
|
78
86
|
</label>
|
79
87
|
`;
|
80
88
|
}
|
81
89
|
};
|
82
|
-
|
83
|
-
let
|
84
|
-
|
85
|
-
|
86
|
-
],
|
87
|
-
|
88
|
-
|
89
|
-
],
|
90
|
-
|
91
|
-
|
92
|
-
],
|
93
|
-
|
94
|
-
|
95
|
-
],
|
96
|
-
|
97
|
-
|
98
|
-
],
|
99
|
-
|
100
|
-
|
101
|
-
],
|
102
|
-
|
103
|
-
|
104
|
-
],
|
105
|
-
|
106
|
-
|
107
|
-
],
|
108
|
-
|
109
|
-
|
110
|
-
],
|
111
|
-
|
112
|
-
|
113
|
-
],
|
90
|
+
n = new WeakMap(), o.styles = [b, z];
|
91
|
+
let s = o;
|
92
|
+
a([
|
93
|
+
h({ type: Boolean })
|
94
|
+
], s.prototype, "debug");
|
95
|
+
a([
|
96
|
+
h({ type: Boolean, reflect: !0 })
|
97
|
+
], s.prototype, "checked");
|
98
|
+
a([
|
99
|
+
h({ type: Boolean, attribute: "hide-label", reflect: !0 })
|
100
|
+
], s.prototype, "hideLabel");
|
101
|
+
a([
|
102
|
+
h()
|
103
|
+
], s.prototype, "label");
|
104
|
+
a([
|
105
|
+
h({ type: String })
|
106
|
+
], s.prototype, "lang");
|
107
|
+
a([
|
108
|
+
h()
|
109
|
+
], s.prototype, "name");
|
110
|
+
a([
|
111
|
+
h({ reflect: !0 })
|
112
|
+
], s.prototype, "size");
|
113
|
+
a([
|
114
|
+
h()
|
115
|
+
], s.prototype, "value");
|
116
|
+
a([
|
117
|
+
C()
|
118
|
+
], s.prototype, "_invalid");
|
119
|
+
a([
|
120
|
+
V("input")
|
121
|
+
], s.prototype, "$input");
|
114
122
|
export {
|
115
|
-
|
123
|
+
s as SkfSwitch
|
116
124
|
};
|
@@ -86,7 +86,7 @@ const e = o`
|
|
86
86
|
}
|
87
87
|
|
88
88
|
&:hover {
|
89
|
-
--_skf-tab-bg-color: var(--skf-color-blue-
|
89
|
+
--_skf-tab-bg-color: var(--skf-color-blue-lightest);
|
90
90
|
}
|
91
91
|
|
92
92
|
:host(:focus-visible) & {
|
@@ -97,7 +97,7 @@ const e = o`
|
|
97
97
|
.tab--expanded.tab--selected {
|
98
98
|
--_skf-tab-bg-color: var(--skf-bg-color-neutral-1);
|
99
99
|
--_skf-tab-border-bottom-color: transparent;
|
100
|
-
--_skf-tab-color: var(--skf-text-color-
|
100
|
+
--_skf-tab-color: var(--skf-text-color-emphasized);
|
101
101
|
|
102
102
|
font-weight: var(--skf-font-weight-bold);
|
103
103
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import '../icon/icon.js';
|
2
2
|
import { SkfElement } from '../../internal/components/skf-element';
|
3
3
|
import type { Icon, Severity } from '../../internal/types.js';
|
4
|
+
import { type Language } from '../../utilities/localize.js';
|
4
5
|
import { type CSSResultGroup } from 'lit';
|
5
6
|
type Size = 'sm' | 'md';
|
6
7
|
/**
|
@@ -25,6 +26,8 @@ export declare class SkfTag extends SkfElement {
|
|
25
26
|
icon?: Icon;
|
26
27
|
/** If defined, gives the supplied appearance */
|
27
28
|
color?: Severity;
|
29
|
+
/** Sets the internal language of the component */
|
30
|
+
lang: Language;
|
28
31
|
/** If defined, accepts a function that runs on click */
|
29
32
|
set onClick(onClickFn: ((event: Event) => void) | undefined);
|
30
33
|
get onClick(): ((event: Event) => void) | undefined;
|
@@ -1,39 +1,41 @@
|
|
1
|
-
var
|
1
|
+
var k = (e) => {
|
2
2
|
throw TypeError(e);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var m = (e, o, t) => (
|
4
|
+
var C = (e, o, t) => o.has(e) || k("Cannot " + t);
|
5
|
+
var m = (e, o, t) => (C(e, o, "read from private field"), t ? t.call(e) : o.get(e)), d = (e, o, t) => o.has(e) ? k("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, t), f = (e, o, t, s) => (C(e, o, "write to private field"), s ? s.call(e, t) : o.set(e, t), t);
|
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 R } from "../../styles/component.styles.js";
|
11
|
+
import { LocalizeController as z } from "../../utilities/localize.js";
|
12
|
+
import { nothing as b, html as u } from "lit";
|
13
|
+
import { property as l, 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, r = (e, o, t, s) => {
|
17
|
+
for (var i = s > 1 ? void 0 : s ? B(o, t) : o, a = e.length - 1, v; a >= 0; a--)
|
18
|
+
(v = e[a]) && (i = (s ? v(o, t, i) : v(i)) || i);
|
19
|
+
return s && i && S(o, t, i), i;
|
19
20
|
};
|
20
|
-
const
|
21
|
+
const _ = {
|
21
22
|
size: ["sm", "md"],
|
22
23
|
color: ["error", "info", "success", "warning"]
|
23
24
|
};
|
24
|
-
var
|
25
|
-
const
|
25
|
+
var c, h, p;
|
26
|
+
const y = class y extends g {
|
26
27
|
constructor() {
|
27
28
|
super(...arguments);
|
28
|
-
d(this,
|
29
|
+
d(this, c);
|
29
30
|
d(this, h);
|
30
|
-
|
31
|
+
d(this, p);
|
32
|
+
f(this, c, new z(this)), f(this, h, this.attachInternals()), f(this, p, m(this, h).states), this.size = "md", this.lang = "en", this.removable = !1, this._handleKeyDown = (t) => {
|
31
33
|
(t.key === "Enter" || t.key === " ") && this.$removeButton.click();
|
32
34
|
}, this._handleRemove = (t) => {
|
33
35
|
this._onRemove && this._onRemove(t);
|
34
36
|
}, this._handleClick = (t) => {
|
35
|
-
var
|
36
|
-
t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (
|
37
|
+
var a;
|
38
|
+
t.stopPropagation(), t.composedPath()[0].localName === "button" ? this.remove() : (a = this.onClick) == null || a.call(this, t);
|
37
39
|
};
|
38
40
|
}
|
39
41
|
set onClick(t) {
|
@@ -54,51 +56,58 @@ const u = class u extends _ {
|
|
54
56
|
disconnectedCallback() {
|
55
57
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
|
56
58
|
}
|
57
|
-
attributeChangedCallback(t,
|
58
|
-
super.attributeChangedCallback(t,
|
59
|
+
attributeChangedCallback(t, s, i) {
|
60
|
+
super.attributeChangedCallback(t, s, i), t === "removable" && i !== null ? this.addEventListener("keydown", this._handleKeyDown) : this.removeEventListener("keydown", this._handleKeyDown);
|
59
61
|
}
|
60
|
-
_handleStateChange(t,
|
61
|
-
|
62
|
+
_handleStateChange(t, s, i) {
|
63
|
+
w(m(this, p), _[t]).set(i);
|
62
64
|
}
|
63
65
|
render() {
|
64
|
-
return
|
66
|
+
return u`
|
65
67
|
<div id="root">
|
66
|
-
${this.icon ?
|
68
|
+
${this.icon ? u`<skf-icon color=${E(this.color)} name=${this.icon} size="sm"></skf-icon>` : b}
|
67
69
|
<slot></slot>
|
68
|
-
${this.removable ?
|
69
|
-
<button
|
70
|
+
${this.removable ? u`
|
71
|
+
<button
|
72
|
+
@click=${this._handleRemove}
|
73
|
+
aria-label=${m(this, c).term("close")}
|
74
|
+
type="button"
|
75
|
+
>
|
70
76
|
<skf-icon name="close" size="xs"></skf-icon>
|
71
77
|
</button>
|
72
|
-
` :
|
78
|
+
` : b}
|
73
79
|
</div>
|
74
80
|
`;
|
75
81
|
}
|
76
82
|
};
|
77
|
-
|
78
|
-
let n =
|
83
|
+
c = new WeakMap(), h = new WeakMap(), p = new WeakMap(), y.styles = [R, P];
|
84
|
+
let n = y;
|
79
85
|
r([
|
80
|
-
|
86
|
+
l({ type: String })
|
81
87
|
], n.prototype, "size", 2);
|
82
88
|
r([
|
83
|
-
|
89
|
+
l({ type: String })
|
84
90
|
], n.prototype, "icon", 2);
|
85
91
|
r([
|
86
|
-
|
92
|
+
l({ type: String })
|
87
93
|
], n.prototype, "color", 2);
|
88
94
|
r([
|
89
|
-
|
95
|
+
l({ type: String })
|
96
|
+
], n.prototype, "lang", 2);
|
97
|
+
r([
|
98
|
+
l({ attribute: !1 })
|
90
99
|
], n.prototype, "onClick", 1);
|
91
100
|
r([
|
92
|
-
|
101
|
+
l({ attribute: !1 })
|
93
102
|
], n.prototype, "onRemove", 1);
|
94
103
|
r([
|
95
|
-
|
104
|
+
l({ type: Boolean })
|
96
105
|
], n.prototype, "removable", 2);
|
97
106
|
r([
|
98
|
-
|
107
|
+
D("button")
|
99
108
|
], n.prototype, "$removeButton", 2);
|
100
109
|
r([
|
101
|
-
|
110
|
+
$(Object.keys(_))
|
102
111
|
], n.prototype, "_handleStateChange", 1);
|
103
112
|
export {
|
104
113
|
n as SkfTag
|
@@ -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 */
|