@skf-design-system/ui-components 0.0.1-beta.4 → 1.0.0-beta.3
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/dist/components/accordion/accordion.component.d.ts +9 -5
- package/dist/components/accordion/accordion.component.js +22 -19
- package/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.styles.js +3 -3
- package/dist/components/alert/alert.component.d.ts +7 -4
- package/dist/components/alert/alert.component.js +1 -1
- package/dist/components/alert/alert.styles.js +1 -1
- package/dist/components/button/button.component.js +1 -1
- package/dist/components/button/button.styles.js +1 -1
- package/dist/components/card/card.component.d.ts +3 -3
- package/dist/components/card/card.component.js +16 -19
- package/dist/components/card/card.styles.js +11 -3
- package/dist/components/checkbox/checkbox.component.d.ts +9 -6
- package/dist/components/checkbox/checkbox.component.js +8 -8
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/components/collapse/collapse.component.d.ts +9 -6
- package/dist/components/collapse/collapse.component.js +39 -36
- package/dist/components/collapse/collapse.styles.js +3 -3
- package/dist/components/collapse/collapse.test.d.ts +1 -0
- package/dist/components/divider/divider.component.d.ts +13 -10
- package/dist/components/divider/divider.component.js +34 -29
- package/dist/components/divider/divider.styles.js +1 -5
- package/dist/components/heading/heading.component.d.ts +12 -2
- 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 +14 -8
- package/dist/components/icon/icon.component.js +6 -6
- package/dist/components/icon/icon.styles.js +1 -1
- package/dist/components/input/input.component.d.ts +34 -29
- package/dist/components/input/input.component.js +36 -36
- package/dist/components/link/link.component.d.ts +15 -12
- package/dist/components/link/link.component.js +7 -7
- package/dist/components/link/link.styles.js +1 -1
- package/dist/components/loader/loader.component.d.ts +7 -7
- package/dist/components/loader/loader.component.js +35 -61
- package/dist/components/loader/loader.styles.js +42 -10
- package/dist/components/logo/logo.component.d.ts +5 -3
- package/dist/components/logo/logo.component.js +8 -8
- package/dist/components/logo/logo.styles.js +2 -2
- package/dist/components/radio/radio.component.d.ts +15 -13
- package/dist/components/radio/radio.component.js +3 -3
- package/dist/components/radio/radio.styles.js +3 -3
- package/dist/components/select/select.component.d.ts +137 -0
- package/dist/components/select/select.component.js +311 -0
- package/dist/components/select/select.controllers.d.ts +59 -0
- package/dist/components/select/select.controllers.js +169 -0
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/select/select.js +6 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.styles.js +116 -0
- package/dist/components/select-option/select-option.component.d.ts +77 -0
- package/dist/components/select-option/select-option.component.js +117 -0
- package/dist/components/select-option/select-option.controllers.d.ts +9 -0
- package/dist/components/select-option/select-option.d.ts +8 -0
- package/dist/components/select-option/select-option.js +6 -0
- package/dist/components/select-option/select-option.styles.d.ts +1 -0
- package/dist/components/select-option/select-option.styles.js +53 -0
- package/dist/components/select-option-group/select-option-group.component.d.ts +16 -0
- package/dist/components/select-option-group/select-option-group.component.js +31 -0
- package/dist/components/select-option-group/select-option-group.d.ts +8 -0
- package/dist/components/select-option-group/select-option-group.js +6 -0
- package/dist/components/select-option-group/select-option-group.style.d.ts +1 -0
- package/dist/components/select-option-group/select-option-group.style.js +18 -0
- package/dist/components/switch/switch.component.d.ts +2 -3
- package/dist/components/switch/switch.component.js +1 -1
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/switch/switch.test.d.ts +1 -0
- package/dist/components/tag/tag.component.d.ts +25 -4
- package/dist/components/tag/tag.component.js +66 -29
- package/dist/components/tag/tag.styles.js +6 -5
- package/dist/components/textarea/textarea.component.d.ts +26 -23
- package/dist/components/textarea/textarea.component.js +15 -12
- package/dist/custom-elements.json +960 -305
- package/dist/index.d.ts +3 -0
- package/dist/index.js +39 -30
- package/dist/internal/components/formBase.d.ts +18 -1
- package/dist/internal/components/formBase.js +25 -13
- package/dist/internal/components/skf-element.d.ts +4 -4
- package/dist/internal/components/skf-element.js +15 -19
- package/dist/internal/helpers/array.d.ts +4 -0
- package/dist/internal/helpers/findMatchingTags.d.ts +2 -0
- package/dist/internal/helpers/findMatchingTags.js +12 -0
- package/dist/internal/helpers/hintSeverity.d.ts +2 -0
- package/dist/internal/helpers/hintSeverity.js +6 -0
- package/dist/internal/helpers/raiseError.d.ts +28 -0
- package/dist/internal/helpers/raiseError.js +29 -0
- package/dist/internal/storybook/shadowRootTraverser.d.ts +16 -6
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/skf-select/index.d.ts +21 -0
- package/dist/react/skf-select/index.js +21 -0
- package/dist/react/skf-select-option/index.d.ts +9 -0
- package/dist/react/skf-select-option/index.js +17 -0
- package/dist/react/skf-select-option-group/index.d.ts +3 -0
- package/dist/react/skf-select-option-group/index.js +13 -0
- package/dist/styles/form-field.styles.js +7 -7
- package/dist/types/jsx/custom-element-jsx.d.ts +290 -140
- package/dist/types/vue/index.d.ts +223 -90
- package/dist/vscode.html-custom-data.json +294 -97
- package/dist/web-types.json +614 -242
- package/package.json +34 -30
@@ -6,10 +6,10 @@ import "lit";
|
|
6
6
|
import { property as r } from "lit/decorators.js";
|
7
7
|
import { ifDefined as n } from "lit/directives/if-defined.js";
|
8
8
|
import { html as f, literal as d } from "lit/static-html.js";
|
9
|
-
var k = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (h, t, i,
|
10
|
-
for (var s =
|
11
|
-
(c = h[
|
12
|
-
return
|
9
|
+
var k = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (h, t, i, p) => {
|
10
|
+
for (var s = p > 1 ? void 0 : p ? v(t, i) : t, l = h.length - 1, c; l >= 0; l--)
|
11
|
+
(c = h[l]) && (s = (p ? c(t, i, s) : c(s)) || s);
|
12
|
+
return p && s && k(t, i, s), s;
|
13
13
|
};
|
14
14
|
const a = class a extends m {
|
15
15
|
constructor() {
|
@@ -20,8 +20,8 @@ const a = class a extends m {
|
|
20
20
|
set onClick(t) {
|
21
21
|
if (!t) return;
|
22
22
|
this._onClick = t;
|
23
|
-
const i = (
|
24
|
-
t(
|
23
|
+
const i = (p) => {
|
24
|
+
t(p, this.href ?? this.route);
|
25
25
|
};
|
26
26
|
this._assertValidOnClick(t), this.removeEventListener("click", i), this.addEventListener("click", i);
|
27
27
|
}
|
@@ -58,7 +58,7 @@ const a = class a extends m {
|
|
58
58
|
@click=${this._preprocessOnClick}
|
59
59
|
download=${n(t ? this.download : void 0)}
|
60
60
|
href=${n(t ? this.href : void 0)}
|
61
|
-
id="
|
61
|
+
id="root"
|
62
62
|
rel=${n(t ? this.rel : void 0)}
|
63
63
|
target=${n(t ? this.target : void 0)}
|
64
64
|
title=${this.title}
|
@@ -1,21 +1,21 @@
|
|
1
1
|
import { SkfElement } from '@internal/components/skf-element.js';
|
2
2
|
import { type CSSResultGroup } from 'lit';
|
3
3
|
/**
|
4
|
-
* The `<skf-loader>` component is a progress indicator that uses circular indicators for short, indeterminate activities
|
4
|
+
* The `<skf-loader>` component is a progress indicator that uses circular indicators for short, indeterminate activities
|
5
5
|
*
|
6
|
-
* @documentation See [
|
6
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/8188a9-loader) for design principles
|
7
7
|
*
|
8
8
|
* @tagname skf-loader
|
9
9
|
*/
|
10
10
|
export declare class SkfLoader extends SkfElement {
|
11
|
+
#private;
|
11
12
|
static styles: CSSResultGroup;
|
13
|
+
/** Defines the aria-label */
|
12
14
|
ariaLabel: string;
|
13
15
|
/** If true, inverts the color (to be used on colored backgrounds) */
|
14
|
-
invert
|
15
|
-
/**
|
16
|
+
invert?: boolean;
|
17
|
+
/** Defines the size of the loader */
|
16
18
|
size?: 'md' | 'sm';
|
17
|
-
|
18
|
-
/** @internal */
|
19
|
-
private getCircle;
|
19
|
+
constructor();
|
20
20
|
render(): import("lit").TemplateResult<1>;
|
21
21
|
}
|
@@ -1,71 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import m from "../../styles/component.styles.js";
|
4
|
-
import { svg as d, html as h } from "lit";
|
5
|
-
import { property as a } from "lit/decorators.js";
|
6
|
-
import v from "./loader.styles.js";
|
7
|
-
var f = Object.defineProperty, o = (l, t, i, g) => {
|
8
|
-
for (var e = void 0, s = l.length - 1, p; s >= 0; s--)
|
9
|
-
(p = l[s]) && (e = p(t, i, e) || e);
|
10
|
-
return e && f(t, i, e), e;
|
1
|
+
var m = (t) => {
|
2
|
+
throw TypeError(t);
|
11
3
|
};
|
12
|
-
|
4
|
+
var f = (t, r, e) => r.has(t) || m("Cannot " + e);
|
5
|
+
var p = (t, r, e) => (f(t, r, "read from private field"), e ? e.call(t) : r.get(t)), h = (t, r, e) => r.has(t) ? m("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), y = (t, r, e, l) => (f(t, r, "write to private field"), l ? l.call(t, e) : r.set(t, e), e);
|
6
|
+
import { SkfElement as u } from "../../internal/components/skf-element.js";
|
7
|
+
import b from "../../styles/component.styles.js";
|
8
|
+
import { html as g } from "lit";
|
9
|
+
import { property as n } from "lit/decorators.js";
|
10
|
+
import _ from "./loader.styles.js";
|
11
|
+
var x = Object.defineProperty, c = (t, r, e, l) => {
|
12
|
+
for (var i = void 0, a = t.length - 1, d; a >= 0; a--)
|
13
|
+
(d = t[a]) && (i = d(r, e, i) || i);
|
14
|
+
return i && x(r, e, i), i;
|
15
|
+
}, s;
|
16
|
+
const v = class v extends u {
|
13
17
|
constructor() {
|
14
|
-
super(
|
15
|
-
|
16
|
-
|
17
|
-
super.connectedCallback(), this.setAttribute("role", "progressbar"), this.setAttribute("aria-live", "polite");
|
18
|
-
}
|
19
|
-
/** @internal */
|
20
|
-
getCircle(t, i) {
|
21
|
-
return d`
|
22
|
-
<circle
|
23
|
-
cx=${t}
|
24
|
-
cy="26"
|
25
|
-
fill=${this.invert ? c.neutralWhite : c.brandBase}
|
26
|
-
key=${t}
|
27
|
-
r="6"
|
28
|
-
stroke="none"
|
29
|
-
>
|
30
|
-
<animate
|
31
|
-
attributeName="opacity"
|
32
|
-
begin=${i}
|
33
|
-
dur="1s"
|
34
|
-
repeatCount="indefinite"
|
35
|
-
values="0;1;0"
|
36
|
-
/>
|
37
|
-
</circle>
|
38
|
-
`;
|
18
|
+
super();
|
19
|
+
h(this, s);
|
20
|
+
this.ariaLabel = "Loading...", this.size = "md", y(this, s, this.attachInternals()), p(this, s).role = "progressbar", p(this, s).ariaLive = "polite";
|
39
21
|
}
|
40
22
|
render() {
|
41
|
-
return
|
42
|
-
<div
|
43
|
-
<
|
44
|
-
|
45
|
-
|
46
|
-
version="1.1"
|
47
|
-
viewBox="0 0 52 52"
|
48
|
-
width="100%"
|
49
|
-
x="0px"
|
50
|
-
y="0px"
|
51
|
-
>
|
52
|
-
${[this.getCircle(6, 0.1), this.getCircle(26, 0.2), this.getCircle(46, 0.3)]}
|
53
|
-
</svg>
|
23
|
+
return g`
|
24
|
+
<div id="root">
|
25
|
+
<div class="circle"></div>
|
26
|
+
<div class="circle"></div>
|
27
|
+
<div class="circle"></div>
|
54
28
|
</div>
|
55
29
|
`;
|
56
30
|
}
|
57
31
|
};
|
58
|
-
|
59
|
-
let
|
60
|
-
|
61
|
-
|
62
|
-
],
|
63
|
-
|
64
|
-
|
65
|
-
],
|
66
|
-
|
67
|
-
|
68
|
-
],
|
32
|
+
s = new WeakMap(), v.styles = [b, _];
|
33
|
+
let o = v;
|
34
|
+
c([
|
35
|
+
n({ reflect: !0, attribute: "aria-label" })
|
36
|
+
], o.prototype, "ariaLabel");
|
37
|
+
c([
|
38
|
+
n({ type: Boolean })
|
39
|
+
], o.prototype, "invert");
|
40
|
+
c([
|
41
|
+
n({ type: String, reflect: !0 })
|
42
|
+
], o.prototype, "size");
|
69
43
|
export {
|
70
|
-
|
44
|
+
o as SkfLoader
|
71
45
|
};
|
@@ -1,18 +1,50 @@
|
|
1
1
|
import { css as s } from "lit";
|
2
|
-
const
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
const e = s`
|
3
|
+
@layer components {
|
4
|
+
:host {
|
5
|
+
display: inline-flex;
|
6
|
+
}
|
7
|
+
|
8
|
+
#root {
|
9
|
+
display: flex;
|
10
|
+
gap: var(--_skf-loader-gap, var(--skf-spacing-50));
|
11
|
+
|
12
|
+
:host([size='sm']) & {
|
13
|
+
--_skf-loader-gap: var(--skf-spacing-25);
|
14
|
+
}
|
15
|
+
}
|
6
16
|
|
7
|
-
|
8
|
-
|
9
|
-
|
17
|
+
.circle {
|
18
|
+
animation: skf-loader 0.5s infinite ease-in alternate;
|
19
|
+
aspect-ratio: 1;
|
20
|
+
background-color: var(--_skf-loader-color, var(--skf-bg-color-emphasised));
|
21
|
+
border-radius: 50%;
|
22
|
+
inline-size: var(--_skf-loader-size, var(--skf-size-12));
|
23
|
+
|
24
|
+
&:nth-child(2) {
|
25
|
+
animation-delay: 0.1s;
|
26
|
+
}
|
27
|
+
|
28
|
+
&:nth-child(3) {
|
29
|
+
animation-delay: 0.2s;
|
30
|
+
}
|
31
|
+
|
32
|
+
:host([invert]) & {
|
33
|
+
--_skf-loader-color: var(--skf-bg-color-neutral-1);
|
34
|
+
}
|
35
|
+
|
36
|
+
:host([size='sm']) & {
|
37
|
+
--_skf-loader-size: var(--skf-size-4);
|
38
|
+
}
|
39
|
+
}
|
10
40
|
|
11
|
-
|
12
|
-
|
41
|
+
@keyframes skf-loader {
|
42
|
+
to {
|
43
|
+
opacity: 0;
|
44
|
+
}
|
13
45
|
}
|
14
46
|
}
|
15
47
|
`;
|
16
48
|
export {
|
17
|
-
|
49
|
+
e as default
|
18
50
|
};
|
@@ -10,10 +10,12 @@ import { type CSSResultGroup } from 'lit';
|
|
10
10
|
*/
|
11
11
|
export declare class SkfLogo extends SkfElement {
|
12
12
|
static styles: CSSResultGroup;
|
13
|
-
/**
|
13
|
+
/** Defines the title of the logo */
|
14
14
|
title: string;
|
15
|
-
/**
|
16
|
-
|
15
|
+
/**
|
16
|
+
* If defined, sets color of the logo
|
17
|
+
* @type { "primary" | "secondary" | "inverse" }
|
18
|
+
*/
|
17
19
|
color?: Logo;
|
18
20
|
render(): import("lit").TemplateResult<1>;
|
19
21
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { SkfElement as i } from "../../internal/components/skf-element.js";
|
2
2
|
import m from "../../styles/component.styles.js";
|
3
3
|
import { html as n } from "lit";
|
4
|
-
import { property as
|
4
|
+
import { property as l } from "lit/decorators.js";
|
5
5
|
import a from "./logo.styles.js";
|
6
|
-
var d = Object.defineProperty, s = (h, o,
|
7
|
-
for (var c = void 0, r = h.length - 1,
|
8
|
-
(
|
9
|
-
return c && d(o,
|
6
|
+
var d = Object.defineProperty, s = (h, o, p, f) => {
|
7
|
+
for (var c = void 0, r = h.length - 1, v; r >= 0; r--)
|
8
|
+
(v = h[r]) && (c = v(o, p, c) || c);
|
9
|
+
return c && d(o, p, c), c;
|
10
10
|
};
|
11
11
|
const e = class e extends i {
|
12
12
|
constructor() {
|
@@ -14,7 +14,7 @@ const e = class e extends i {
|
|
14
14
|
}
|
15
15
|
render() {
|
16
16
|
return n`
|
17
|
-
<svg id="
|
17
|
+
<svg id="root" viewBox="0 0 1300 300" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px">
|
18
18
|
<title>${this.title}</title>
|
19
19
|
<g>
|
20
20
|
<g>
|
@@ -58,10 +58,10 @@ c0,5.8-4.3,6.1-9.1,6.1H1230.9z"
|
|
58
58
|
e.styles = [m, a];
|
59
59
|
let t = e;
|
60
60
|
s([
|
61
|
-
|
61
|
+
l()
|
62
62
|
], t.prototype, "title");
|
63
63
|
s([
|
64
|
-
|
64
|
+
l()
|
65
65
|
], t.prototype, "color");
|
66
66
|
export {
|
67
67
|
t as SkfLogo
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
2
|
const r = o`
|
3
3
|
:host {
|
4
|
-
display:
|
4
|
+
display: inline-flex;
|
5
5
|
}
|
6
6
|
|
7
|
-
#
|
7
|
+
#root {
|
8
8
|
aspect-ratio: 13 / 3;
|
9
9
|
block-size: var(--skf-logo-height, var(--skf-size-32));
|
10
10
|
fill: var(--_skf-logo-color, var(--skf-logo-primary));
|
@@ -5,40 +5,42 @@ import { type CSSResultGroup } from 'lit';
|
|
5
5
|
/**
|
6
6
|
* The `<skf-radio>` component is used to create a radio input
|
7
7
|
*
|
8
|
-
* @documentation See [
|
8
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/78d5dd-radio-button) for design principles
|
9
9
|
*
|
10
10
|
* @attribute {boolean} disabled - If true, sets disabled state
|
11
11
|
* @attribute {boolean} required - If true, value is required or must be checked for the form to be submittable
|
12
12
|
*
|
13
13
|
* @event change {object} - When the value of the input changes
|
14
14
|
*
|
15
|
-
* @slot
|
15
|
+
* @slot - The radios label. Alternatively, you can use the `label` attribute.
|
16
16
|
*
|
17
17
|
* @tagname skf-radio
|
18
18
|
*/
|
19
19
|
export declare class SkfRadio extends FormBase implements FormFieldBaseProps {
|
20
20
|
static styles: CSSResultGroup;
|
21
|
-
/** @internal */
|
22
21
|
private _initialChecked;
|
23
|
-
/** If
|
24
|
-
debug?: boolean
|
22
|
+
/** If true, outputs helping hints in console */
|
23
|
+
debug?: boolean;
|
25
24
|
/** If true, outputs helping hints in console */
|
26
25
|
checked?: boolean;
|
27
26
|
/** If true, forces component to invalid state until removed */
|
28
27
|
customInvalid?: boolean;
|
29
28
|
/** If true, hides the label visually */
|
30
|
-
hideLabel
|
31
|
-
/**
|
29
|
+
hideLabel?: boolean;
|
30
|
+
/** If defined, sets the input's label unless the default slot is used. Alternatively, you can use the `label` attribute. */
|
32
31
|
label?: string;
|
33
|
-
/** If
|
32
|
+
/** If defined, adds name to the input-element */
|
34
33
|
name?: string;
|
35
|
-
/** If
|
34
|
+
/** If defined, renders an alternative A11y text for the asterisk */
|
36
35
|
requiredLabel?: string;
|
37
|
-
/**
|
38
|
-
size
|
39
|
-
/**
|
36
|
+
/** Size of the Radio */
|
37
|
+
size: 'sm' | 'md';
|
38
|
+
/**
|
39
|
+
* If defined, displays provided severity state
|
40
|
+
* @type {"success" | "info" | "warning" | "alert"}
|
41
|
+
*/
|
40
42
|
severity?: FormFieldBaseProps['severity'];
|
41
|
-
/** If
|
43
|
+
/** If true, displays valid state after interaction */
|
42
44
|
showValid?: boolean;
|
43
45
|
/** The current value of the input field */
|
44
46
|
value: string;
|
@@ -14,7 +14,7 @@ var k = Object.defineProperty, i = (n, t, r, l) => {
|
|
14
14
|
};
|
15
15
|
const d = class d extends u {
|
16
16
|
constructor() {
|
17
|
-
super(...arguments), this._initialChecked = !1, this.
|
17
|
+
super(...arguments), this._initialChecked = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
|
18
18
|
t.stopPropagation(), this.checked = this._initialChecked, this.$input && (this.$input.checked = !!this._initialChecked), this.setFormValue(this.checked ? this.value : "");
|
19
19
|
};
|
20
20
|
}
|
@@ -70,7 +70,7 @@ const d = class d extends u {
|
|
70
70
|
}
|
71
71
|
render() {
|
72
72
|
return m`
|
73
|
-
<label id="
|
73
|
+
<label id="root">
|
74
74
|
<input
|
75
75
|
?disabled=${this.disabled}
|
76
76
|
?required=${this.required}
|
@@ -115,7 +115,7 @@ i([
|
|
115
115
|
a({ reflect: !0 })
|
116
116
|
], e.prototype, "size");
|
117
117
|
i([
|
118
|
-
a(
|
118
|
+
a()
|
119
119
|
], e.prototype, "severity");
|
120
120
|
i([
|
121
121
|
a({ type: Boolean, attribute: "show-valid" })
|
@@ -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 i = [
|
4
4
|
r,
|
5
5
|
o`
|
6
6
|
@layer components {
|
@@ -8,7 +8,7 @@ const e = [
|
|
8
8
|
contain: initial;
|
9
9
|
}
|
10
10
|
|
11
|
-
#
|
11
|
+
#root {
|
12
12
|
align-items: center;
|
13
13
|
display: flex;
|
14
14
|
grid-gap: var(--skf-spacing-50);
|
@@ -94,5 +94,5 @@ const e = [
|
|
94
94
|
`
|
95
95
|
];
|
96
96
|
export {
|
97
|
-
|
97
|
+
i as default
|
98
98
|
};
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import { FormBase } from '@internal/components/formBase.js';
|
2
|
+
import type { FormFieldBaseProps } from '@internal/types/formField.js';
|
3
|
+
import { type CSSResultGroup } from 'lit';
|
4
|
+
import '../../internal/components/hint/hint';
|
5
|
+
import type { SelectOptionEvent, SkfSelectOption } from '../select-option/select-option.component.js';
|
6
|
+
import '../tag/tag';
|
7
|
+
import { DeveloperFeedbackController, GlobalClickController, KeyboardNavigationController, ResizeController, ScrollController } from './select.controllers.js';
|
8
|
+
/**
|
9
|
+
* TODO: abstract the popover logic to a separate component/helper/partial, and use it in both select and in input[datalist], combobox etc
|
10
|
+
*
|
11
|
+
* TODO: Fix the popover positioning, it should be relative to the button, not the window (low priority since we have solution and is it possible at all on something in #toplayer)
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* The `<skf-select>` is a component that displays a list of actions or options. A click in the options list toggle the selected state of the option. Use it together with the ´skf-select-option` tag.
|
15
|
+
*
|
16
|
+
* @documentation See [InVision DSM](https://skf.invisionapp.com/dsm/ab-skf/4-web-applications/nav/5fa7caf78c01200018354495/asset/6229d63d9fe16020a60657e5) for design principles
|
17
|
+
*
|
18
|
+
* @attribute {boolean} [disabled] - If true, the select is disabled `default: false`
|
19
|
+
*
|
20
|
+
* @slot - The select's placeholder content
|
21
|
+
*
|
22
|
+
* @event change - Fired when the selected option(s) changes
|
23
|
+
* @event invalid - Fired when the select is invalid
|
24
|
+
* @event reset - Fired when the form is reset
|
25
|
+
* @event skf-select:dropdown - {detail: {expanded: boolean}} Fired when the select dropdown is toggled
|
26
|
+
* @event skf-select-option:select - {detail: {value: string | null, option: SkfSelectOption}} Fired when the select dropdown is toggled
|
27
|
+
*
|
28
|
+
* @tagname skf-select
|
29
|
+
*/
|
30
|
+
export declare class SkfSelect extends FormBase {
|
31
|
+
static styles: CSSResultGroup;
|
32
|
+
/** @internal */
|
33
|
+
selectDelay: number;
|
34
|
+
/** @internal */
|
35
|
+
_optionsList: SkfSelectOption[];
|
36
|
+
/** Sets the first visible text on the component */
|
37
|
+
buttonLabel: string;
|
38
|
+
/** If defined, forces component to invalid state until removed */
|
39
|
+
customInvalid?: string;
|
40
|
+
/** If true, hides the label visually */
|
41
|
+
hideLabel?: boolean;
|
42
|
+
/** If true and mulltiple is true, no tags are displayed under the select */
|
43
|
+
hideTags?: boolean;
|
44
|
+
/** If defined, sets the hint text under the select component in the form */
|
45
|
+
hint?: string;
|
46
|
+
/** A readonly property that returns the selected value(s) in a array */
|
47
|
+
get getSelectedValues(): string[];
|
48
|
+
/** A readonly property that returns the selected slot(s) text content in a array */
|
49
|
+
get getSelectedOptionsText(): (string | null)[];
|
50
|
+
/** If defined, displays provided label */
|
51
|
+
label?: string;
|
52
|
+
/** If defined, limits the number of selectable options */
|
53
|
+
max?: number;
|
54
|
+
/** If defined, sets the minimum number of required options */
|
55
|
+
min?: number;
|
56
|
+
/** If true, allows for multiple options to be selected */
|
57
|
+
multiple?: boolean;
|
58
|
+
/** If defined, set name of the component */
|
59
|
+
name?: string;
|
60
|
+
/** If defined, renders an alternative A11y text for the asterisk */
|
61
|
+
requiredLabel?: string;
|
62
|
+
/** If defined, displays provided severity state */
|
63
|
+
severity?: FormFieldBaseProps['severity'];
|
64
|
+
/** If true, displays valid state after interaction */
|
65
|
+
showValid?: boolean;
|
66
|
+
/** Size of the Select */
|
67
|
+
size: 'sm' | 'md';
|
68
|
+
/** Read only, returns the selected value. (if multiple: in a comma separated string) */
|
69
|
+
get value(): string;
|
70
|
+
/** Stores the selected SkfSelectOption tag(s) in a array. Is the source of truth for the internal state. */
|
71
|
+
/** @internal */
|
72
|
+
private _selectedOptions;
|
73
|
+
/** @internal */
|
74
|
+
/** The selected options in an array. Treat it as a read only property. See selectedValues, slectedSlots for computed value arrays. */
|
75
|
+
set selectedOptions(option: SkfSelectOption[]);
|
76
|
+
/** @internal */
|
77
|
+
get selectedOptions(): SkfSelectOption[];
|
78
|
+
/** @internal */
|
79
|
+
_expanded: boolean;
|
80
|
+
/** @internal */
|
81
|
+
/** True if the internal state is invalid */
|
82
|
+
private _invalid;
|
83
|
+
/** @internal */
|
84
|
+
private $selectBtn?;
|
85
|
+
/** @internal */
|
86
|
+
private $selectedValue?;
|
87
|
+
/** @internal */
|
88
|
+
private $dropdown?;
|
89
|
+
/** @internal */
|
90
|
+
protected scrollController: ScrollController;
|
91
|
+
/** @internal */
|
92
|
+
protected resizeController: ResizeController;
|
93
|
+
/** @internal */
|
94
|
+
protected globalClickController: GlobalClickController;
|
95
|
+
/** @internal */
|
96
|
+
protected keyboardNavController: KeyboardNavigationController;
|
97
|
+
/** @internal */
|
98
|
+
protected developerFeedbackController: DeveloperFeedbackController;
|
99
|
+
constructor();
|
100
|
+
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
101
|
+
firstUpdated(): void;
|
102
|
+
updated(changedProperties: Map<string, unknown>): void;
|
103
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
104
|
+
disconnectedCallback(): void;
|
105
|
+
/** @internal */
|
106
|
+
_handleOptionSelected: EventListener;
|
107
|
+
/** @internal */
|
108
|
+
_updateState(event: CustomEvent<SelectOptionEvent>): void;
|
109
|
+
/** @internal */
|
110
|
+
_handleReset: () => void;
|
111
|
+
/** @internal */
|
112
|
+
onUpdateComplete(): Promise<string>;
|
113
|
+
/** @internal */
|
114
|
+
/** Filter out elements other than skf-select-option and store in this._optionsList */
|
115
|
+
_collectSlotOptionTags(): void;
|
116
|
+
/** @internal */
|
117
|
+
_updateWidth: () => void;
|
118
|
+
/** @internal */
|
119
|
+
/** this runs only from the 'updated' lifecycle, by setting source-of-truth _expanded=false */
|
120
|
+
private _managePopover;
|
121
|
+
/** @internal */
|
122
|
+
_handleDropdownToggle: (e: Event) => void;
|
123
|
+
/** @internal
|
124
|
+
* Sets the value of the select component based on the selected options.
|
125
|
+
* Also closes the dropdown if not multiple.
|
126
|
+
*/
|
127
|
+
_setValue: () => Promise<unknown>;
|
128
|
+
/** @internal */
|
129
|
+
_resetSelectedOptions: (target?: SkfSelectOption) => void;
|
130
|
+
/** @internal */
|
131
|
+
_handleSlotChange: () => void;
|
132
|
+
/** @internal */
|
133
|
+
_computeVisibleValue: () => string;
|
134
|
+
/** @internal */
|
135
|
+
private _validateInput;
|
136
|
+
render(): import("lit").TemplateResult<1>;
|
137
|
+
}
|