@skf-design-system/ui-components 1.0.0-beta.3 → 1.0.0-beta.5
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/alert/alert.component.js +20 -18
- package/dist/components/alert/alert.styles.js +50 -47
- package/dist/components/button/button.component.d.ts +2 -0
- package/dist/components/button/button.component.js +5 -5
- package/dist/components/checkbox/checkbox.styles.js +6 -1
- package/dist/components/icon/icon.styles.js +56 -54
- package/dist/components/input/input.component.d.ts +9 -0
- package/dist/components/input/input.component.js +32 -24
- package/dist/components/radio/radio.styles.js +7 -2
- package/dist/components/select/select.component.d.ts +5 -2
- package/dist/components/select/select.component.js +99 -86
- package/dist/components/select/select.controllers.js +5 -2
- package/dist/components/select/select.styles.js +15 -0
- package/dist/components/select-option/select-option.component.d.ts +2 -2
- package/dist/components/select-option/select-option.component.js +16 -10
- package/dist/components/switch/switch.styles.js +5 -0
- 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.style.d.ts +1 -0
- package/dist/components/toast/toast.style.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.style.d.ts +2 -0
- package/dist/components/toast-item/toast-item.style.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.style.d.ts +1 -0
- package/dist/components/toast-wrapper/toast-wrapper.style.js +20 -0
- package/dist/custom-elements.json +450 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -40
- package/dist/internal/components/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +2 -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/form-field.styles.js +4 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +41 -3
- package/dist/types/vue/index.d.ts +42 -2
- package/dist/vscode.html-custom-data.json +40 -1
- package/dist/web-types.json +90 -4
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,13 +1,33 @@
|
|
1
1
|
<div align="center">
|
2
|
-
<!--img alt="Ferris Logotype" src="./.github/assets/ferris_logo_dark.svg" width="128"/ -->
|
3
2
|
|
4
3
|
# SKF UI Components
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div align="center">
|
8
|
+
<a href="https://www.npmjs.com/package/@skf-design-system/ui-components">
|
9
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40skf-design-system%2Fui-components?style=for-the-badge&logo=npm">
|
10
|
+
</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
<div align="center">
|
16
|
+
<a href="https://codesandbox.io/p/sandbox/exciting-leftpad-hz6sgm">
|
17
|
+
<img alt="CodeSandbox" src="https://img.shields.io/badge/Codesandbox-040404?style=for-the-badge&logo=codesandbox&logoColor=DBDBDB" />
|
18
|
+
</a>
|
19
|
+
<a href="https://github.com/SKF-Internal/ui-components/issues">
|
20
|
+
<img alt="GitHub - Issues" src="https://img.shields.io/badge/Issues-%23121011.svg?style=for-the-badge&logo=github&logoColor=white" />
|
21
|
+
</a>
|
22
|
+
<a href="https://teams.microsoft.com/l/team/19%3A15d8521717e14c419998b0fed71289a5%40thread.tacv2/conversations?groupId=286b39ed-ed94-43da-8a3f-383319f6c9dc&tenantId=41875f2b-33e8-4670-92a8-f643afbb243a">
|
23
|
+
<img alt="MS Teams" src="https://img.shields.io/badge/MS Teams-4E5FBF?style=for-the-badge&logo=windows&logoColor=white">
|
24
|
+
</a>
|
25
|
+
<a href="https://beta--641c13cdbf6bbfbd6da88a83.chromatic.com">
|
26
|
+
<img alt="Storybook - Stable" src="https://img.shields.io/badge/Stable-FF4785?style=for-the-badge&logo=storybook&logoColor=white">
|
27
|
+
</a>
|
28
|
+
<a href="https://zeroheight.com/853e936c9/p/07d378-component-overview">
|
29
|
+
<img alt="Storybook - Beta" src="https://img.shields.io/badge/zeroheight-F63E7C?style=for-the-badge">
|
30
|
+
</a>
|
11
31
|
</div>
|
12
32
|
|
13
33
|
## Introduction
|
@@ -1,30 +1,32 @@
|
|
1
1
|
import "../icon/icon.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
3
3
|
import b from "../../styles/component.styles.js";
|
4
|
-
import { html as
|
4
|
+
import { html as p, nothing as f } from "lit";
|
5
5
|
import { property as o } from "lit/decorators.js";
|
6
|
-
import { ifDefined as
|
7
|
-
import
|
8
|
-
var
|
9
|
-
for (var t = void 0,
|
10
|
-
(
|
11
|
-
return t &&
|
6
|
+
import { ifDefined as s } from "lit/directives/if-defined.js";
|
7
|
+
import u from "./alert.styles.js";
|
8
|
+
var h = Object.defineProperty, i = (n, a, m, y) => {
|
9
|
+
for (var t = void 0, r = n.length - 1, c; r >= 0; r--)
|
10
|
+
(c = n[r]) && (t = c(a, m, t) || t);
|
11
|
+
return t && h(a, m, t), t;
|
12
12
|
};
|
13
|
-
const l = class l extends
|
13
|
+
const l = class l extends d {
|
14
14
|
constructor() {
|
15
|
-
super(...arguments), this.buttonLabel = "Close", this._handleClose = () =>
|
15
|
+
super(...arguments), this.buttonLabel = "Close", this._handleClose = () => {
|
16
|
+
this.emit("skf-alert-close");
|
17
|
+
};
|
16
18
|
}
|
17
19
|
render() {
|
18
|
-
return
|
20
|
+
return p`
|
19
21
|
<div
|
20
22
|
id="root"
|
21
23
|
aria-describedby="main"
|
22
|
-
aria-modal=${
|
24
|
+
aria-modal=${s(this.closeable && "true")}
|
23
25
|
role=${this.closeable ? "alertdialog" : "alert"}
|
24
26
|
>
|
25
27
|
<skf-icon
|
26
|
-
color=${
|
27
|
-
name=${
|
28
|
+
color=${s(this.severity ?? "secondary")}
|
29
|
+
name=${s(this.icon)}
|
28
30
|
size="sm"
|
29
31
|
></skf-icon>
|
30
32
|
<div id="body">
|
@@ -33,7 +35,7 @@ const l = class l extends c {
|
|
33
35
|
</div>
|
34
36
|
<slot name="link"></slot>
|
35
37
|
</div>
|
36
|
-
${this.closeable ?
|
38
|
+
${this.closeable ? p`
|
37
39
|
<button @click="${this._handleClose}" aria-label=${this.buttonLabel} type="button">
|
38
40
|
<skf-icon name="close" size="sm"></skf-icon>
|
39
41
|
</button>
|
@@ -42,10 +44,10 @@ const l = class l extends c {
|
|
42
44
|
`;
|
43
45
|
}
|
44
46
|
};
|
45
|
-
l.styles = [b,
|
47
|
+
l.styles = [b, u];
|
46
48
|
let e = l;
|
47
49
|
i([
|
48
|
-
o({ type: Boolean })
|
50
|
+
o({ type: Boolean, reflect: !0 })
|
49
51
|
], e.prototype, "closeable");
|
50
52
|
i([
|
51
53
|
o({ attribute: "button-label" })
|
@@ -54,7 +56,7 @@ i([
|
|
54
56
|
o()
|
55
57
|
], e.prototype, "icon");
|
56
58
|
i([
|
57
|
-
o()
|
59
|
+
o({ reflect: !0 })
|
58
60
|
], e.prototype, "severity");
|
59
61
|
export {
|
60
62
|
e as SkfAlert
|
@@ -1,61 +1,64 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
2
|
const s = r`
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#root {
|
8
|
-
background-color: var(--_skf-alert-bg-color, var(--skf-bg-color-neutral-2));
|
9
|
-
border: var(--skf-border-width-sm) solid
|
10
|
-
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
11
|
-
border-radius: var(--skf-border-radius-sm);
|
12
|
-
box-shadow: var(--skf-shadow-md);
|
13
|
-
display: flex;
|
14
|
-
font-size: var(--skf-font-size-75);
|
15
|
-
gap: var(--skf-spacing-50);
|
16
|
-
padding-block: var(--skf-spacing-75);
|
17
|
-
padding-inline: var(--skf-spacing-50);
|
18
|
-
|
19
|
-
:host([severity='alert']) & {
|
20
|
-
--_skf-alert-bg-color: var(--skf-severity-bg-color-alert);
|
21
|
-
--_skf-alert-border-color: var(--skf-severity-fg-color-alert);
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
contain: layout;
|
22
6
|
}
|
23
7
|
|
24
|
-
|
25
|
-
--_skf-alert-bg-color
|
26
|
-
|
27
|
-
|
8
|
+
#root {
|
9
|
+
background-color: var(--_skf-alert-bg-color, var(--skf-bg-color-neutral-2));
|
10
|
+
border: var(--skf-border-width-sm) solid
|
11
|
+
var(--_skf-alert-border-color, var(--skf-border-color-primary));
|
12
|
+
border-radius: var(--skf-border-radius-sm);
|
13
|
+
box-shadow: var(--skf-shadow-md);
|
14
|
+
display: flex;
|
15
|
+
font-size: var(--skf-font-size-75);
|
16
|
+
gap: var(--skf-spacing-50);
|
17
|
+
padding-block: var(--skf-spacing-75);
|
18
|
+
padding-inline: var(--skf-spacing-50);
|
28
19
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
20
|
+
:host([severity='alert']) & {
|
21
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-alert);
|
22
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-alert);
|
23
|
+
}
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
:host([severity='error']) & {
|
26
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-error);
|
27
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-error);
|
28
|
+
}
|
29
|
+
|
30
|
+
:host([severity='info']) & {
|
31
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-info);
|
32
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-info);
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([severity='success']) & {
|
36
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-success);
|
37
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-success);
|
38
|
+
}
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
:host([severity='warning']) & {
|
41
|
+
--_skf-alert-bg-color: var(--skf-severity-bg-color-warning);
|
42
|
+
--_skf-alert-border-color: var(--skf-severity-fg-color-warning);
|
43
|
+
}
|
42
44
|
}
|
43
|
-
}
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
#body {
|
47
|
+
display: flex;
|
48
|
+
flex: auto;
|
49
|
+
flex-wrap: wrap;
|
50
|
+
gap: var(--skf-spacing-25) var(--skf-spacing-100);
|
51
|
+
justify-content: space-between;
|
52
|
+
}
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
::slotted(skf-link) {
|
55
|
+
text-transform: uppercase;
|
56
|
+
}
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
button {
|
59
|
+
cursor: pointer;
|
60
|
+
display: inline-flex;
|
61
|
+
}
|
59
62
|
}
|
60
63
|
`;
|
61
64
|
export {
|
@@ -14,6 +14,7 @@ export declare class SkfButton extends SkfElement {
|
|
14
14
|
static styles: CSSResultGroup;
|
15
15
|
/** @internal */
|
16
16
|
private _transitionOptions;
|
17
|
+
_internals: ElementInternals;
|
17
18
|
/** If true, gives destructive appearance. **Notice!** Only applicable if `variant` is `primary`. */
|
18
19
|
destructive: boolean;
|
19
20
|
/** If true, removes border */
|
@@ -38,6 +39,7 @@ export declare class SkfButton extends SkfElement {
|
|
38
39
|
private $loader?;
|
39
40
|
/** @internal */
|
40
41
|
private $body?;
|
42
|
+
constructor();
|
41
43
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
42
44
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
43
45
|
private _showLoader;
|
@@ -6,17 +6,17 @@ import { html as d } from "lit";
|
|
6
6
|
import { property as e, state as m, query as f } from "lit/decorators.js";
|
7
7
|
import { ifDefined as y } from "lit/directives/if-defined.js";
|
8
8
|
import u from "./button.styles.js";
|
9
|
-
var _ = Object.defineProperty, i = (
|
10
|
-
for (var s = void 0, n =
|
11
|
-
(
|
9
|
+
var _ = Object.defineProperty, i = (h, o, r, a) => {
|
10
|
+
for (var s = void 0, n = h.length - 1, p; n >= 0; n--)
|
11
|
+
(p = h[n]) && (s = p(o, r, s) || s);
|
12
12
|
return s && _(o, r, s), s;
|
13
13
|
};
|
14
14
|
const l = class l extends c {
|
15
15
|
constructor() {
|
16
|
-
super(
|
16
|
+
super(), this._transitionOptions = {
|
17
17
|
duration: 200,
|
18
18
|
fill: "forwards"
|
19
|
-
}, this.destructive = !1, this.disabled = !1, this.iconPosition = "left", this.loading = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._renderIcon = () => d`<skf-icon class="skf-icon-host" name=${y(this.icon)}></skf-icon
|
19
|
+
}, this.destructive = !1, this.disabled = !1, this.iconPosition = "left", this.loading = !1, this.size = "md", this.type = "button", this.variant = "primary", this._loaderVisible = !1, this._renderIcon = () => d`<skf-icon class="skf-icon-host" name=${y(this.icon)}></skf-icon>`, this._internals = this.attachInternals();
|
20
20
|
}
|
21
21
|
firstUpdated(o) {
|
22
22
|
if (o.has("loading") && this.loading) {
|
@@ -10,10 +10,15 @@ const i = [
|
|
10
10
|
|
11
11
|
#root {
|
12
12
|
align-items: center;
|
13
|
+
color: var(--_skf-checkbox-color, var(--skf-text-color-primary));
|
13
14
|
display: grid;
|
14
15
|
grid-gap: var(--skf-spacing-50);
|
15
16
|
grid-template: 'input label' / auto minmax(0, 1fr);
|
16
17
|
|
18
|
+
:host([disabled]) & {
|
19
|
+
--_skf-checkbox-color: var(--skf-interactive-text-color-disabled);
|
20
|
+
}
|
21
|
+
|
17
22
|
:host([size='sm']) & {
|
18
23
|
--_skf-checkbox-size: var(--skf-size-20);
|
19
24
|
|
@@ -57,7 +62,7 @@ const i = [
|
|
57
62
|
}
|
58
63
|
|
59
64
|
:host([valid]) & {
|
60
|
-
--_skf-checkbox-border-color: var(--skf-severity-fg-color-
|
65
|
+
--_skf-checkbox-border-color: var(--skf-severity-fg-color-success);
|
61
66
|
}
|
62
67
|
|
63
68
|
:host([severity='alert']:not([invalid], [valid])) & {
|
@@ -1,73 +1,75 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
2
|
const r = o`
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
display: inline-flex;
|
6
|
+
}
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
#root {
|
9
|
+
--_skf-icon-size: var(--skf-icon-size-md);
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
block-size: var(--_skf-icon-size);
|
12
|
+
color: var(--_skf-icon-color, var(--skf-icon-color-primary));
|
13
|
+
display: inline-flex;
|
14
|
+
flex-shrink: 0; /* Prevents shrink when flex-child */
|
15
|
+
inline-size: var(--_skf-icon-size);
|
16
|
+
pointer-events: none;
|
17
|
+
user-select: none;
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
:host-context(.skf-icon-host) & {
|
20
|
+
color: inherit;
|
21
|
+
}
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
/**
|
24
|
+
* Colors
|
25
|
+
*/
|
26
|
+
:host([color='secondary']) & {
|
27
|
+
--_skf-icon-color: var(--skf-icon-color-secondary);
|
28
|
+
}
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
:host([color='inverse']) & {
|
31
|
+
--_skf-icon-color: var(--skf-icon-color-inverse);
|
32
|
+
}
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
:host([color='emphasised']) & {
|
35
|
+
--_skf-icon-color: var(--skf-icon-color-emphasised);
|
36
|
+
}
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
/* Severity */
|
39
|
+
:host([color='alert']) & {
|
40
|
+
--_skf-icon-color: var(--skf-severity-fg-color-alert);
|
41
|
+
}
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
:host([color='error']) & {
|
44
|
+
--_skf-icon-color: var(--skf-severity-fg-color-error);
|
45
|
+
}
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
:host([color='info']) & {
|
48
|
+
--_skf-icon-color: var(--skf-severity-fg-color-info);
|
49
|
+
}
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
:host([color='success']) & {
|
52
|
+
--_skf-icon-color: var(--skf-severity-fg-color-success);
|
53
|
+
}
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
:host([color='warning']) & {
|
56
|
+
--_skf-icon-color: var(--skf-severity-fg-color-warning);
|
57
|
+
}
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
/**
|
60
|
+
* Sizes
|
61
|
+
*/
|
62
|
+
:host([size='xs']) & {
|
63
|
+
--_skf-icon-size: var(--skf-icon-size-xs);
|
64
|
+
}
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
:host([size='sm']) & {
|
67
|
+
--_skf-icon-size: var(--skf-icon-size-sm);
|
68
|
+
}
|
68
69
|
|
69
|
-
|
70
|
-
|
70
|
+
:host([size='lg']) & {
|
71
|
+
--_skf-icon-size: var(--skf-icon-size-lg);
|
72
|
+
}
|
71
73
|
}
|
72
74
|
}
|
73
75
|
`;
|
@@ -55,6 +55,11 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
55
55
|
minLength?: number;
|
56
56
|
/** If defined, adds name to the input-element */
|
57
57
|
name?: string;
|
58
|
+
/**
|
59
|
+
* @internal
|
60
|
+
* If true, hide empty label element
|
61
|
+
*/
|
62
|
+
protected _noLabel: boolean | undefined;
|
58
63
|
/** If defined, adds name to the input-element */
|
59
64
|
pattern?: string;
|
60
65
|
/** If defined, displays placeholder text */
|
@@ -91,6 +96,8 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
91
96
|
/** @internal */
|
92
97
|
$input: HTMLInputElement;
|
93
98
|
/** @internal */
|
99
|
+
_defaultSlot: Node[];
|
100
|
+
/** @internal */
|
94
101
|
private _numberController;
|
95
102
|
/** @internal */
|
96
103
|
private _passwordController;
|
@@ -124,5 +131,7 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
124
131
|
private _renderSearchButton;
|
125
132
|
/** @internal */
|
126
133
|
private _onBlur;
|
134
|
+
/** @internal */
|
135
|
+
_handleSlotChange: () => void;
|
127
136
|
render(): import("lit").TemplateResult<1>;
|
128
137
|
}
|
@@ -1,23 +1,23 @@
|
|
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
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 s, state as
|
8
|
+
import { property as s, state as p, query as _, queryAssignedNodes as $ } from "lit/decorators.js";
|
9
9
|
import { ifDefined as a } from "lit/directives/if-defined.js";
|
10
|
-
import { live as
|
11
|
-
import { InputNumberController as
|
12
|
-
import
|
13
|
-
var
|
14
|
-
for (var o = n > 1 ? void 0 : n ?
|
15
|
-
(u =
|
16
|
-
return n && o &&
|
10
|
+
import { live as g } from "lit/directives/live.js";
|
11
|
+
import { InputNumberController as w, InputPasswordController as E } from "./input.controllers.js";
|
12
|
+
import C from "./input.styles.js";
|
13
|
+
var S = Object.defineProperty, L = Object.getOwnPropertyDescriptor, i = (c, e, r, n) => {
|
14
|
+
for (var o = n > 1 ? void 0 : n ? L(e, r) : e, l = c.length - 1, u; l >= 0; l--)
|
15
|
+
(u = c[l]) && (o = (n ? u(e, r, o) : u(o)) || o);
|
16
|
+
return n && o && S(e, r, o), o;
|
17
17
|
};
|
18
|
-
const
|
18
|
+
const m = class m extends b {
|
19
19
|
constructor() {
|
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
|
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
22
|
}, this._resetValue = (e) => {
|
23
23
|
var r;
|
@@ -36,7 +36,7 @@ const p = class p extends c {
|
|
36
36
|
@mouseup=${this._handlePressEnd}
|
37
37
|
@mouseleave=${this._handlePressEnd}
|
38
38
|
aria-label="${e === "inc" ? "Increment" : "Decrement"}"
|
39
|
-
class="number"
|
39
|
+
class="number skf-icon-host"
|
40
40
|
type="button"
|
41
41
|
>
|
42
42
|
<skf-icon name="${e === "inc" ? "chevronUp" : "chevronDown"}" size="sm"></skf-icon>
|
@@ -45,7 +45,7 @@ const p = class p extends c {
|
|
45
45
|
<button
|
46
46
|
@click=${this._passwordController.toggleVisibility}
|
47
47
|
aria-label=${a(this._passwordController._buttonAriaLabel)}
|
48
|
-
class="password"
|
48
|
+
class="password skf-icon-host"
|
49
49
|
type="button"
|
50
50
|
@mousedown="${this._handlePressStart}"
|
51
51
|
@mouseup="${this._handlePressEnd}"
|
@@ -60,13 +60,16 @@ const p = class p extends c {
|
|
60
60
|
@mouseup=${this._handlePressEnd}
|
61
61
|
@mouseleave=${this._handlePressEnd}
|
62
62
|
aria-label=${a(this.buttonAriaLabelClear)}
|
63
|
-
class="search"
|
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
|
+
}, this._handleSlotChange = () => {
|
71
|
+
var e, r;
|
72
|
+
console.log("slot change"), this._noLabel = (this._defaultSlot.length === 0 || !((r = (e = this._defaultSlot[0]) == null ? void 0 : e.textContent) != null && r.trim())) && !this.label;
|
70
73
|
};
|
71
74
|
}
|
72
75
|
set customInvalid(e) {
|
@@ -80,7 +83,7 @@ const p = class p extends c {
|
|
80
83
|
this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input.value || ""), this.emitEvent("change"), this.validateInput();
|
81
84
|
}), this.addEventListener("invalid", (e) => {
|
82
85
|
this._pristine = !1, this.invalid = !0, this.customErrorDisplay && e.preventDefault();
|
83
|
-
}), this.addEventListener("reset", this._resetValue), this.validateInput();
|
86
|
+
}), this.addEventListener("reset", this._resetValue), this._handleSlotChange(), this.validateInput();
|
84
87
|
}
|
85
88
|
willUpdate(e) {
|
86
89
|
if (e.has("invalid"))
|
@@ -128,12 +131,12 @@ const p = class p extends c {
|
|
128
131
|
return h`
|
129
132
|
<div id="root">
|
130
133
|
<label>
|
131
|
-
<div class=${this.hideLabel ? "visually-hidden" : ""} id="label">
|
132
|
-
<slot>${this.label}</slot>
|
134
|
+
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${this._noLabel} id="label">
|
135
|
+
<slot @slotchange=${this._handleSlotChange}>${this.label}</slot>
|
133
136
|
${this.required ? y(this.requiredLabel) : null}
|
134
137
|
</div>
|
135
138
|
<div id="input">
|
136
|
-
${this.type === "search" ? h`<skf-icon name="search" size="sm"></skf-icon>` : d}
|
139
|
+
${this.type === "search" ? h`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : d}
|
137
140
|
<div
|
138
141
|
data-leading=${a(this.leading)}
|
139
142
|
data-trailing=${a(this.trailing)}
|
@@ -143,7 +146,7 @@ const p = class p extends c {
|
|
143
146
|
?disabled=${this.disabled}
|
144
147
|
?readonly=${this.readonly}
|
145
148
|
?required=${this.required}
|
146
|
-
.value=${
|
149
|
+
.value=${g(this.value)}
|
147
150
|
@blur=${this._onBlur}
|
148
151
|
@input=${this._handleInput}
|
149
152
|
aria-describedby=${a((e = this.hint) != null && e.trim() ? "hint" : d)}
|
@@ -159,7 +162,6 @@ const p = class p extends c {
|
|
159
162
|
name=${a(this.name)}
|
160
163
|
pattern=${a(this.pattern)}
|
161
164
|
placeholder=${a(this.placeholder)}
|
162
|
-
title=""
|
163
165
|
type=${a(
|
164
166
|
this.type === "password" ? this._passwordController._type : this.type
|
165
167
|
)}
|
@@ -186,8 +188,8 @@ const p = class p extends c {
|
|
186
188
|
`;
|
187
189
|
}
|
188
190
|
};
|
189
|
-
|
190
|
-
let t =
|
191
|
+
m.styles = [f, C];
|
192
|
+
let t = m;
|
191
193
|
i([
|
192
194
|
s({ attribute: "button-aria-label-clear" })
|
193
195
|
], t.prototype, "buttonAriaLabelClear", 2);
|
@@ -233,6 +235,9 @@ i([
|
|
233
235
|
i([
|
234
236
|
s()
|
235
237
|
], t.prototype, "name", 2);
|
238
|
+
i([
|
239
|
+
p()
|
240
|
+
], t.prototype, "_noLabel", 2);
|
236
241
|
i([
|
237
242
|
s()
|
238
243
|
], t.prototype, "pattern", 2);
|
@@ -267,14 +272,17 @@ i([
|
|
267
272
|
s()
|
268
273
|
], t.prototype, "value", 2);
|
269
274
|
i([
|
270
|
-
|
275
|
+
p()
|
271
276
|
], t.prototype, "invalid", 2);
|
272
277
|
i([
|
273
|
-
|
278
|
+
p()
|
274
279
|
], t.prototype, "_buttonDown", 2);
|
275
280
|
i([
|
276
281
|
_("input")
|
277
282
|
], t.prototype, "$input", 2);
|
283
|
+
i([
|
284
|
+
$({ flatten: !0 })
|
285
|
+
], t.prototype, "_defaultSlot", 2);
|
278
286
|
export {
|
279
287
|
t as SkfInput
|
280
288
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { visuallyHidden as r } from "../../styles/util.styles.js";
|
2
2
|
import { css as o } from "lit";
|
3
|
-
const
|
3
|
+
const e = [
|
4
4
|
r,
|
5
5
|
o`
|
6
6
|
@layer components {
|
@@ -10,9 +10,14 @@ const i = [
|
|
10
10
|
|
11
11
|
#root {
|
12
12
|
align-items: center;
|
13
|
+
color: var(--_skf-radio-color, var(--skf-text-color-primary));
|
13
14
|
display: flex;
|
14
15
|
grid-gap: var(--skf-spacing-50);
|
15
16
|
|
17
|
+
:host([disabled]) & {
|
18
|
+
--_skf-radio-color: var(--skf-interactive-text-color-disabled);
|
19
|
+
}
|
20
|
+
|
16
21
|
:host([size='sm']) & {
|
17
22
|
--_skf-radio-size: var(--skf-size-20);
|
18
23
|
|
@@ -94,5 +99,5 @@ const i = [
|
|
94
99
|
`
|
95
100
|
];
|
96
101
|
export {
|
97
|
-
|
102
|
+
e as default
|
98
103
|
};
|
@@ -44,9 +44,11 @@ export declare class SkfSelect extends FormBase {
|
|
44
44
|
/** If defined, sets the hint text under the select component in the form */
|
45
45
|
hint?: string;
|
46
46
|
/** A readonly property that returns the selected value(s) in a array */
|
47
|
-
|
47
|
+
set selectedValues(values: string[]);
|
48
|
+
get selectedValues(): string[];
|
48
49
|
/** A readonly property that returns the selected slot(s) text content in a array */
|
49
|
-
|
50
|
+
set selectedOptionsText(values: string[]);
|
51
|
+
get selectedOptionsText(): string[];
|
50
52
|
/** If defined, displays provided label */
|
51
53
|
label?: string;
|
52
54
|
/** If defined, limits the number of selectable options */
|
@@ -66,6 +68,7 @@ export declare class SkfSelect extends FormBase {
|
|
66
68
|
/** Size of the Select */
|
67
69
|
size: 'sm' | 'md';
|
68
70
|
/** Read only, returns the selected value. (if multiple: in a comma separated string) */
|
71
|
+
set value(newValue: string);
|
69
72
|
get value(): string;
|
70
73
|
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
71
74
|
/** @internal */
|