@skf-design-system/ui-components 0.0.1-beta.4 → 1.0.0-alpha.27
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 +16 -9
- package/dist/components/checkbox/checkbox.component.js +32 -31
- package/dist/components/checkbox/checkbox.styles.js +7 -2
- package/dist/components/checkbox/checkbox.test.d.ts +1 -0
- package/dist/components/collapse/collapse.component.d.ts +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 +56 -54
- package/dist/components/input/input.component.d.ts +34 -29
- package/dist/components/input/input.component.js +43 -43
- 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 +6 -1
- package/dist/components/select/select.component.d.ts +137 -0
- package/dist/components/select/select.component.js +312 -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 +131 -0
- package/dist/components/select-option/select-option.component.d.ts +77 -0
- package/dist/components/select-option/select-option.component.js +123 -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 +6 -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 +969 -295
- 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/hint/hint.component.js +12 -10
- package/dist/internal/components/hint/hint.styles.js +26 -10
- 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 +11 -7
- package/dist/types/jsx/custom-element-jsx.d.ts +292 -140
- package/dist/types/vue/index.d.ts +225 -90
- package/dist/vscode.html-custom-data.json +299 -97
- package/dist/web-types.json +624 -242
- package/package.json +34 -30
@@ -1,23 +1,26 @@
|
|
1
1
|
import '@components/collapse/collapse.js';
|
2
2
|
import { SkfElement } from '@internal/components/skf-element.js';
|
3
3
|
import type { HeadingType } from '@internal/constants/heading.js';
|
4
|
-
import { type CSSResultGroup } from 'lit';
|
4
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
5
5
|
/**
|
6
6
|
* The `<skf-accordion>` component consists of multiple `<skf-collapse>`, working together.
|
7
7
|
*
|
8
|
-
* See [
|
8
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/6590bf-accordion) for design principles.
|
9
9
|
*
|
10
10
|
* @slot - Expects one or more <skf-accordion-item> element(s)
|
11
11
|
*
|
12
|
-
* @
|
12
|
+
* @tagname skf-accordion
|
13
13
|
*/
|
14
14
|
export declare class SkfAccordion extends SkfElement {
|
15
15
|
static styles: CSSResultGroup;
|
16
16
|
/** If true, will animate the expand/collapse state */
|
17
17
|
animated?: boolean;
|
18
|
-
/**
|
18
|
+
/**
|
19
|
+
* Defines which heading element will be rendered
|
20
|
+
* @type { "h1" | "h2" | "h3" | "h4" }
|
21
|
+
*/
|
19
22
|
headingAs: Exclude<HeadingType, 'h1'>;
|
20
|
-
/** If
|
23
|
+
/** If true, adds a gap between each item */
|
21
24
|
gap?: boolean;
|
22
25
|
/** If true, allowes multiple accordion items to open */
|
23
26
|
multiple?: boolean;
|
@@ -27,6 +30,7 @@ export declare class SkfAccordion extends SkfElement {
|
|
27
30
|
truncate?: boolean;
|
28
31
|
/** @internal */
|
29
32
|
private $accordionItems;
|
33
|
+
protected updated(_changedProperties: PropertyValues): void;
|
30
34
|
/** @internal */
|
31
35
|
private get items();
|
32
36
|
/** @internal */
|
@@ -1,22 +1,25 @@
|
|
1
1
|
import "../collapse/collapse.js";
|
2
|
-
import { SkfElement as
|
2
|
+
import { SkfElement as p } from "../../internal/components/skf-element.js";
|
3
3
|
import m from "../../styles/component.styles.js";
|
4
|
-
import { html as
|
5
|
-
import { property as
|
4
|
+
import { html as f } from "lit";
|
5
|
+
import { property as a, queryAssignedNodes as d } from "lit/decorators.js";
|
6
6
|
import c from "./accordion.styles.js";
|
7
|
-
var g = Object.defineProperty, r = (
|
8
|
-
for (var s = void 0, l =
|
9
|
-
(h =
|
7
|
+
var g = Object.defineProperty, r = (u, t, i, o) => {
|
8
|
+
for (var s = void 0, l = u.length - 1, h; l >= 0; l--)
|
9
|
+
(h = u[l]) && (s = h(t, i, s) || s);
|
10
10
|
return s && g(t, i, s), s;
|
11
11
|
};
|
12
|
-
const n = class n extends
|
12
|
+
const n = class n extends p {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.headingAs = "h2", this._setItemAttributes = () => {
|
15
15
|
this.items.forEach((t) => {
|
16
|
-
t.setAttribute("heading-as", this.headingAs), this.animated
|
16
|
+
t.setAttribute("heading-as", this.headingAs), this.animated ? t.setAttribute("animated", "") : t.hasAttribute("animated") && t.removeAttribute("animated"), this.small ? t.setAttribute("small", "") : t.hasAttribute("small") && t.removeAttribute("small"), this.truncate ? t.setAttribute("truncate", "") : t.hasAttribute("truncate") && t.removeAttribute("truncate");
|
17
17
|
});
|
18
18
|
};
|
19
19
|
}
|
20
|
+
updated(t) {
|
21
|
+
(t.has("animated") || t.has("headingAs") || t.has("small") || t.has("truncate")) && this._setItemAttributes();
|
22
|
+
}
|
20
23
|
/** @internal */
|
21
24
|
get items() {
|
22
25
|
return [...this.$accordionItems].filter((t) => t.localName === "skf-accordion-item");
|
@@ -24,13 +27,13 @@ const n = class n extends u {
|
|
24
27
|
_onChildToggle(t) {
|
25
28
|
if (this.multiple || t.defaultPrevented) return;
|
26
29
|
const i = t.target;
|
27
|
-
this.items.length && this.items.forEach((
|
28
|
-
|
30
|
+
this.items.length && this.items.forEach((o) => {
|
31
|
+
o !== i && o.hasAttribute("expanded") && o.setClose();
|
29
32
|
});
|
30
33
|
}
|
31
34
|
render() {
|
32
|
-
return
|
33
|
-
<div id="
|
35
|
+
return f`
|
36
|
+
<div id="root">
|
34
37
|
<slot
|
35
38
|
@skf-collapse-toggle=${(t) => {
|
36
39
|
this._onChildToggle(t);
|
@@ -44,25 +47,25 @@ const n = class n extends u {
|
|
44
47
|
n.styles = [c, m];
|
45
48
|
let e = n;
|
46
49
|
r([
|
47
|
-
|
50
|
+
a({ type: Boolean, reflect: !0 })
|
48
51
|
], e.prototype, "animated");
|
49
52
|
r([
|
50
|
-
|
53
|
+
a({ attribute: "heading-as" })
|
51
54
|
], e.prototype, "headingAs");
|
52
55
|
r([
|
53
|
-
|
56
|
+
a({ type: Boolean, reflect: !0 })
|
54
57
|
], e.prototype, "gap");
|
55
58
|
r([
|
56
|
-
|
59
|
+
a({ type: Boolean })
|
57
60
|
], e.prototype, "multiple");
|
58
61
|
r([
|
59
|
-
|
62
|
+
a({ type: Boolean, reflect: !0 })
|
60
63
|
], e.prototype, "small");
|
61
64
|
r([
|
62
|
-
|
65
|
+
a({ type: Boolean, reflect: !0 })
|
63
66
|
], e.prototype, "truncate");
|
64
67
|
r([
|
65
|
-
|
68
|
+
d()
|
66
69
|
], e.prototype, "$accordionItems");
|
67
70
|
export {
|
68
71
|
e as SkfAccordion
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
|
-
const
|
2
|
+
const t = o`
|
3
3
|
@layer components {
|
4
|
-
:host([gap]) #
|
4
|
+
:host([gap]) #root {
|
5
5
|
display: flex;
|
6
6
|
flex-direction: column;
|
7
7
|
gap: var(--skf-spacing-300);
|
@@ -9,5 +9,5 @@ const a = o`
|
|
9
9
|
}
|
10
10
|
`;
|
11
11
|
export {
|
12
|
-
|
12
|
+
t as default
|
13
13
|
};
|
@@ -6,24 +6,27 @@ import { type CSSResultGroup } from 'lit';
|
|
6
6
|
/**
|
7
7
|
* The `<skf-alert>` is a type of notification that appears in-line
|
8
8
|
*
|
9
|
-
* @documentation See [
|
9
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/990ec5-alert) for design principles
|
10
10
|
*
|
11
11
|
* @event skf-alert-close - Fires when the close button is clicked
|
12
12
|
*
|
13
13
|
* @slot - Alert message. **Notice!** See design principles for approved content
|
14
|
-
* @slot link -
|
14
|
+
* @slot link - Slot for the link
|
15
15
|
*
|
16
16
|
* @tagname skf-alert
|
17
17
|
*/
|
18
18
|
export declare class SkfAlert extends SkfElement {
|
19
19
|
static styles: CSSResultGroup;
|
20
|
-
/** If true, alert is being used as a toast with an close button */
|
20
|
+
/** If true, alert is being used as a toast (alertdialog) with an close button */
|
21
21
|
closeable?: boolean;
|
22
22
|
/** Close button aria-label */
|
23
23
|
buttonLabel: string;
|
24
24
|
/** If defined, displays leading icon */
|
25
25
|
icon?: SkfIcon['name'];
|
26
|
-
/**
|
26
|
+
/**
|
27
|
+
* If defined, gives the supplied appearance
|
28
|
+
* @type { "error" | "info" | "warning" | "success" | "alert" }
|
29
|
+
*/
|
27
30
|
severity?: SeverityFgColor;
|
28
31
|
/** @internal */
|
29
32
|
private _handleClose;
|
@@ -39,7 +39,7 @@ const l = class l extends c {
|
|
39
39
|
<button
|
40
40
|
?disabled=${this.disabled || this.loading}
|
41
41
|
aria-busy=${this.loading}
|
42
|
-
id="
|
42
|
+
id="root"
|
43
43
|
type=${y(this.type)}
|
44
44
|
>
|
45
45
|
${this.variant === "primary" && this._loaderVisible ? d`<skf-loader invert size="sm"></skf-loader>` : ""}
|
@@ -12,10 +12,10 @@ import { type CSSResultGroup } from 'lit';
|
|
12
12
|
export declare class SkfCard extends SkfElement {
|
13
13
|
static styles: CSSResultGroup;
|
14
14
|
/** If true, removes border */
|
15
|
-
noBorder
|
15
|
+
noBorder?: boolean;
|
16
16
|
/** If true, removes padding */
|
17
|
-
noPadding
|
17
|
+
noPadding?: boolean;
|
18
18
|
/** If true, the Card fills the parent element height */
|
19
|
-
stretch
|
19
|
+
stretch?: boolean;
|
20
20
|
render(): import("lit").TemplateResult<1>;
|
21
21
|
}
|
@@ -1,36 +1,33 @@
|
|
1
1
|
import { SkfElement as d } from "../../internal/components/skf-element.js";
|
2
|
-
import
|
2
|
+
import a from "../../styles/component.styles.js";
|
3
3
|
import { html as f } from "lit";
|
4
4
|
import { property as r } from "lit/decorators.js";
|
5
5
|
import y from "./card.styles.js";
|
6
|
-
var
|
7
|
-
for (var t = void 0,
|
8
|
-
(
|
9
|
-
return t &&
|
6
|
+
var v = Object.defineProperty, p = (i, l, s, u) => {
|
7
|
+
for (var t = void 0, e = i.length - 1, m; e >= 0; e--)
|
8
|
+
(m = i[e]) && (t = m(l, s, t) || t);
|
9
|
+
return t && v(l, s, t), t;
|
10
10
|
};
|
11
11
|
const n = class n extends d {
|
12
|
-
constructor() {
|
13
|
-
super(...arguments), this.noBorder = !1, this.noPadding = !1, this.stretch = !1;
|
14
|
-
}
|
15
12
|
render() {
|
16
13
|
return f`
|
17
|
-
<div id="
|
14
|
+
<div id="root">
|
18
15
|
<slot></slot>
|
19
16
|
</div>
|
20
17
|
`;
|
21
18
|
}
|
22
19
|
};
|
23
|
-
n.styles = [
|
24
|
-
let
|
25
|
-
|
20
|
+
n.styles = [a, y];
|
21
|
+
let o = n;
|
22
|
+
p([
|
26
23
|
r({ type: Boolean, attribute: "no-border" })
|
27
|
-
],
|
28
|
-
|
24
|
+
], o.prototype, "noBorder");
|
25
|
+
p([
|
29
26
|
r({ type: Boolean, attribute: "no-padding" })
|
30
|
-
],
|
31
|
-
|
32
|
-
r({ type: Boolean })
|
33
|
-
],
|
27
|
+
], o.prototype, "noPadding");
|
28
|
+
p([
|
29
|
+
r({ type: Boolean, reflect: !0 })
|
30
|
+
], o.prototype, "stretch");
|
34
31
|
export {
|
35
|
-
|
32
|
+
o as SkfCard
|
36
33
|
};
|
@@ -1,6 +1,14 @@
|
|
1
1
|
import { css as r } from "lit";
|
2
|
-
const
|
3
|
-
|
2
|
+
const s = r`
|
3
|
+
:host {
|
4
|
+
contain: layout;
|
5
|
+
}
|
6
|
+
|
7
|
+
:host([stretch]) {
|
8
|
+
block-size: 100%;
|
9
|
+
}
|
10
|
+
|
11
|
+
#root {
|
4
12
|
background-color: var(--skf-bg-color-neutral-1);
|
5
13
|
border: var(--skf-border-width-sm) solid
|
6
14
|
var(--_skf-card-border-color, var(--skf-border-color-tertiary));
|
@@ -22,5 +30,5 @@ const d = r`
|
|
22
30
|
}
|
23
31
|
`;
|
24
32
|
export {
|
25
|
-
|
33
|
+
s as default
|
26
34
|
};
|
@@ -5,21 +5,24 @@ import { type CSSResultGroup } from 'lit';
|
|
5
5
|
/**
|
6
6
|
* The `<skf-checkbox>` component is used to create a checkbox input
|
7
7
|
*
|
8
|
-
* @documentation See [
|
8
|
+
* @documentation See [zeroheight](https://zeroheight.com/853e936c9/p/94464f-checkbox) 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-checkbox
|
18
18
|
*/
|
19
19
|
export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps {
|
20
20
|
static styles: CSSResultGroup;
|
21
|
-
/**
|
22
|
-
|
21
|
+
/**
|
22
|
+
* @internal
|
23
|
+
* Initial state saved here as default for form resets.
|
24
|
+
*/
|
25
|
+
private _initiallyChecked;
|
23
26
|
/** If defined, outputs helping hints in console */
|
24
27
|
debug?: boolean;
|
25
28
|
/** If true, outputs helping hints in console */
|
@@ -30,18 +33,23 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
30
33
|
hideLabel?: boolean;
|
31
34
|
/** If true and the checkbox is unchecked, the checkbox will appear indeterminate */
|
32
35
|
indeterminate?: boolean;
|
36
|
+
/** Read only indicator of the local state. Use custom-invalid to set it to invalid state. */
|
37
|
+
invalid?: boolean;
|
33
38
|
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
34
39
|
label?: string;
|
35
40
|
/** If defined, adds name to the input-element */
|
36
41
|
name?: string;
|
37
42
|
/** If defined, renders an alternative A11y text for the asterisk */
|
38
43
|
requiredLabel?: string;
|
39
|
-
/**
|
40
|
-
|
41
|
-
|
44
|
+
/**
|
45
|
+
* If defined, styles checkbox using provided severity
|
46
|
+
* @type { "alert" | "success" | "info" | "warning" }
|
47
|
+
*/
|
42
48
|
severity?: FormFieldBaseProps['severity'];
|
43
|
-
/** If
|
49
|
+
/** If true, displays valid state after interaction */
|
44
50
|
showValid?: boolean;
|
51
|
+
/** Size of the checkbox */
|
52
|
+
size: 'sm' | 'md';
|
45
53
|
/** The current value of the input field */
|
46
54
|
value: string;
|
47
55
|
/** @internal */
|
@@ -53,7 +61,6 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
53
61
|
willUpdate(changedProperties: Map<string | number | symbol, unknown>): void;
|
54
62
|
protected firstUpdated(): void;
|
55
63
|
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
56
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
57
64
|
debugOutput(): void;
|
58
65
|
/** @internal */
|
59
66
|
private _validateInput;
|
@@ -6,15 +6,15 @@ import { html as u, nothing as m } from "lit";
|
|
6
6
|
import { property as s, state as f, query as y } from "lit/decorators.js";
|
7
7
|
import { ifDefined as b } from "lit/directives/if-defined.js";
|
8
8
|
import _ from "./checkbox.styles.js";
|
9
|
-
var
|
10
|
-
for (var
|
11
|
-
(d =
|
12
|
-
return
|
9
|
+
var g = Object.defineProperty, i = (h, t, a, l) => {
|
10
|
+
for (var r = void 0, o = h.length - 1, d; o >= 0; o--)
|
11
|
+
(d = h[o]) && (r = d(t, a, r) || r);
|
12
|
+
return r && g(t, a, r), r;
|
13
13
|
};
|
14
|
-
const
|
14
|
+
const n = class n extends p {
|
15
15
|
constructor() {
|
16
|
-
super(...arguments), this.
|
17
|
-
t.stopPropagation(), this.checked = this.
|
16
|
+
super(...arguments), this._initiallyChecked = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
|
17
|
+
t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = !!this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
|
18
18
|
}, this._renderIcon = (t) => u`
|
19
19
|
<skf-icon color="inverse" name=${t} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
|
20
20
|
`;
|
@@ -23,28 +23,26 @@ const h = class h extends p {
|
|
23
23
|
super.connectedCallback(), this._validateInput();
|
24
24
|
}
|
25
25
|
willUpdate(t) {
|
26
|
-
t.has("
|
26
|
+
if (t.has("customInvalid"))
|
27
|
+
if (this.customInvalid) {
|
28
|
+
const a = this.getAttribute("data-customerror") ?? "Custom error";
|
29
|
+
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.showValid && this.removeAttribute("valid"), this.checkValidity();
|
30
|
+
} else
|
31
|
+
console.log("remove invalid"), this.invalid = !1, !this.pristine && this.showValid && this.setAttribute("valid", "true"), this.setValidity({}), this._validateInput();
|
32
|
+
t.has("_invalid") && (this.invalid = this._invalid);
|
27
33
|
}
|
28
34
|
firstUpdated() {
|
29
35
|
var t;
|
30
|
-
(t = this.$input) == null || t.addEventListener("change", (
|
31
|
-
var
|
32
|
-
|
33
|
-
}), this.addEventListener("invalid", (
|
34
|
-
this.pristine = !1, this._invalid = !0, this.customErrorDisplay &&
|
35
|
-
}), this.
|
36
|
+
(t = this.$input) == null || t.addEventListener("change", (a) => {
|
37
|
+
var l;
|
38
|
+
a.stopPropagation(), this.pristine = !1, this.checked = (l = this.$input) == null ? void 0 : l.checked, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
|
39
|
+
}), this.addEventListener("invalid", (a) => {
|
40
|
+
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && a.preventDefault();
|
41
|
+
}), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue);
|
36
42
|
}
|
37
43
|
updated(t) {
|
38
44
|
super.updated(t), t.has("_invalid") && this._invalid && this.debug && this.debugOutput();
|
39
45
|
}
|
40
|
-
attributeChangedCallback(t, r, a) {
|
41
|
-
if (super.attributeChangedCallback(t, r, a), t === "custom-invalid")
|
42
|
-
if (typeof a == "string") {
|
43
|
-
const o = String(a).trim() || "Custom error";
|
44
|
-
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, o), this.checkValidity();
|
45
|
-
} else
|
46
|
-
this.setValidity({}), this._validateInput();
|
47
|
-
}
|
48
46
|
debugOutput() {
|
49
47
|
this.debug && !this.validity.valid && console.log(`Checkbox invalidity reason: ${this.validationMessage}`);
|
50
48
|
}
|
@@ -55,14 +53,14 @@ const h = class h extends p {
|
|
55
53
|
this.setValidity({ customError: !0 }, "Custom error"), this._invalid = !0;
|
56
54
|
else if (this.required && !this.checked) {
|
57
55
|
this.pristine || (this._invalid = !0);
|
58
|
-
const
|
59
|
-
this.setValidity({ valueMissing: !0 }, String(
|
56
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : ((t = this.$input) == null ? void 0 : t.validationMessage) ?? "Please check this box if you want to proceed";
|
57
|
+
this.setValidity({ valueMissing: !0 }, String(a));
|
60
58
|
} else
|
61
59
|
this.setValidity({});
|
62
60
|
}
|
63
61
|
render() {
|
64
62
|
return u`
|
65
|
-
<label id="
|
63
|
+
<label id="root">
|
66
64
|
<input
|
67
65
|
?checked=${this.checked}
|
68
66
|
?disabled=${this.disabled}
|
@@ -82,8 +80,8 @@ const h = class h extends p {
|
|
82
80
|
`;
|
83
81
|
}
|
84
82
|
};
|
85
|
-
|
86
|
-
let e =
|
83
|
+
n.styles = [v, _];
|
84
|
+
let e = n;
|
87
85
|
i([
|
88
86
|
s({ type: Boolean })
|
89
87
|
], e.prototype, "debug");
|
@@ -91,7 +89,7 @@ i([
|
|
91
89
|
s({ type: Boolean, reflect: !0 })
|
92
90
|
], e.prototype, "checked");
|
93
91
|
i([
|
94
|
-
s({ type: Boolean, attribute: "custom-invalid" })
|
92
|
+
s({ type: Boolean, attribute: "custom-invalid", reflect: !0 })
|
95
93
|
], e.prototype, "customInvalid");
|
96
94
|
i([
|
97
95
|
s({ type: Boolean, attribute: "hide-label", reflect: !0 })
|
@@ -99,6 +97,9 @@ i([
|
|
99
97
|
i([
|
100
98
|
s({ type: Boolean, reflect: !0 })
|
101
99
|
], e.prototype, "indeterminate");
|
100
|
+
i([
|
101
|
+
s({ type: Boolean, reflect: !0 })
|
102
|
+
], e.prototype, "invalid");
|
102
103
|
i([
|
103
104
|
s()
|
104
105
|
], e.prototype, "label");
|
@@ -108,15 +109,15 @@ i([
|
|
108
109
|
i([
|
109
110
|
s({ attribute: "required-label" })
|
110
111
|
], e.prototype, "requiredLabel");
|
111
|
-
i([
|
112
|
-
s({ reflect: !0 })
|
113
|
-
], e.prototype, "size");
|
114
112
|
i([
|
115
113
|
s({ reflect: !0 })
|
116
114
|
], e.prototype, "severity");
|
117
115
|
i([
|
118
116
|
s({ type: Boolean, attribute: "show-valid" })
|
119
117
|
], e.prototype, "showValid");
|
118
|
+
i([
|
119
|
+
s({ reflect: !0 })
|
120
|
+
], e.prototype, "size");
|
120
121
|
i([
|
121
122
|
s()
|
122
123
|
], e.prototype, "value");
|
@@ -8,12 +8,17 @@ const i = [
|
|
8
8
|
contain: initial;
|
9
9
|
}
|
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
|
|
@@ -52,7 +57,7 @@ const i = [
|
|
52
57
|
--_skf-checkbox-border-color: var(--skf-interactive-border-color-disabled);
|
53
58
|
}
|
54
59
|
|
55
|
-
|
60
|
+
&[aria-invalid='true'] {
|
56
61
|
--_skf-checkbox-border-color: var(--skf-severity-fg-color-error);
|
57
62
|
}
|
58
63
|
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -5,7 +5,7 @@ import type { CSSResultGroup } from 'lit';
|
|
5
5
|
/**
|
6
6
|
* The `<skf-collapse>` component is a general purpose container for content that can be collapsed / expanded.
|
7
7
|
*
|
8
|
-
* See [
|
8
|
+
* See [zeroheight](https://zeroheight.com/853e936c9/p/6590bf-accordion) for design principles.
|
9
9
|
*
|
10
10
|
* @event {CustomEvent} skf-collapse-toggle - Event emitted when toggled
|
11
11
|
*
|
@@ -16,17 +16,20 @@ import type { CSSResultGroup } from 'lit';
|
|
16
16
|
export declare class SkfCollapse extends SkfElement {
|
17
17
|
static styles: CSSResultGroup;
|
18
18
|
/** If true, will animate the expand/collapse state */
|
19
|
-
animated
|
19
|
+
animated?: boolean;
|
20
20
|
/** If true, will set the collapse to be expanded by default */
|
21
|
-
expanded
|
21
|
+
expanded?: boolean;
|
22
22
|
/** Heading for the collapse */
|
23
23
|
heading?: string;
|
24
|
-
/**
|
24
|
+
/**
|
25
|
+
* Defines which heading element will be rendered
|
26
|
+
* @type { "h1" | "h2" | "h3" | "h4" }
|
27
|
+
*/
|
25
28
|
headingAs: Exclude<HeadingType, 'h1'>;
|
26
29
|
/** If true, renders the small version */
|
27
|
-
small
|
30
|
+
small?: boolean;
|
28
31
|
/** If true, will truncate the heading in collapsed state */
|
29
|
-
truncate
|
32
|
+
truncate?: boolean;
|
30
33
|
/** Class method as alternative to manipulate attribute */
|
31
34
|
setClose(): void;
|
32
35
|
/** Class method as alternative to manipulate attribute */
|