@skf-design-system/ui-components 1.0.2-beta.5 → 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/accordion/accordion.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.js +2 -2
- 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 +151 -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.d.ts +3 -0
- package/dist/components/divider/divider.component.js +43 -22
- package/dist/components/divider/divider.styles.js +9 -9
- package/dist/components/drawer/drawer.component.d.ts +11 -4
- package/dist/components/drawer/drawer.component.js +77 -55
- package/dist/components/drawer/drawer.styles.js +47 -40
- package/dist/components/header/header.component.d.ts +4 -2
- package/dist/components/header/header.component.js +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 +147 -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.d.ts +15 -18
- package/dist/components/link/link.component.js +105 -107
- package/dist/components/link/link.styles.js +53 -45
- package/dist/components/loader/loader.component.d.ts +5 -3
- package/dist/components/loader/loader.component.js +39 -28
- package/dist/components/loader/loader.styles.js +6 -10
- package/dist/components/menu/menu-item.component.d.ts +1 -1
- package/dist/components/menu/menu-item.component.js +8 -8
- package/dist/components/menu/menu-item.styles.js +13 -9
- package/dist/components/menu/menu.component.d.ts +5 -2
- package/dist/components/menu/menu.component.js +8 -8
- package/dist/components/nav/nav-item.component.d.ts +4 -0
- package/dist/components/nav/nav-item.component.js +44 -25
- package/dist/components/nav/nav-item.styles.js +29 -25
- package/dist/components/nav/nav.component.d.ts +9 -0
- package/dist/components/nav/nav.component.js +47 -21
- package/dist/components/nav/nav.styles.js +15 -9
- package/dist/components/popover/popover.component.d.ts +10 -3
- package/dist/components/popover/popover.component.js +30 -22
- package/dist/components/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.styles.js +4 -4
- 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-group.component.d.ts +4 -0
- package/dist/components/select/select-option-group.component.js +37 -18
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +7 -2
- package/dist/components/select/select-option.component.js +70 -53
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +18 -10
- package/dist/components/select/select.component.js +175 -132
- package/dist/components/select/select.controllers.js +2 -1
- package/dist/components/select/select.styles.js +8 -2
- package/dist/components/stepper/stepper-item.component.d.ts +1 -1
- package/dist/components/stepper/stepper-item.component.js +26 -23
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/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-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +19 -16
- package/dist/components/tabs/tab.component.d.ts +1 -1
- package/dist/components/tabs/tab.component.js +17 -14
- package/dist/components/tabs/tab.styles.js +2 -2
- package/dist/components/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 +127 -118
- package/dist/components/toast/toast-item.styles.js +13 -10
- package/dist/components/toast/toast.component.js +9 -9
- package/dist/components/toast/toast.singleton.d.ts +1 -1
- package/dist/components/toast/toast.singleton.js +18 -18
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +13 -7
- package/dist/custom-elements.json +1305 -946
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +28 -29
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- package/dist/internal/components/hint/hint.component.d.ts +4 -0
- package/dist/internal/components/hint/hint.component.js +47 -20
- package/dist/internal/components/hint/hint.styles.js +29 -25
- 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/internal/types.d.ts +4 -0
- package/dist/styles/global-alt.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +27 -0
- package/dist/translations/es.d.ts +3 -0
- package/dist/translations/es.js +27 -0
- package/dist/translations/index.d.ts +4 -0
- package/dist/translations/pt.d.ts +3 -0
- package/dist/translations/pt.js +27 -0
- package/dist/translations/sv.d.ts +3 -0
- package/dist/translations/sv.js +27 -0
- package/dist/types/jsx/custom-element-jsx.d.ts +243 -128
- package/dist/types/vue/index.d.ts +136 -127
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +168 -177
- package/dist/web-types.json +411 -381
- package/package.json +34 -41
package/README.md
CHANGED
@@ -351,6 +351,24 @@ Checklist:
|
|
351
351
|
|
352
352
|
</details>
|
353
353
|
|
354
|
+
## Known inconsistencies coming from the React library and v1 Web Components
|
355
|
+
|
356
|
+
Our focus going forward is on the v2 package of Web Components (new brand design) and as our bandwidth is limited work done to the v1 Web Compnent library will be very limited.
|
357
|
+
|
358
|
+
| React Component | WC v1 - Solution |
|
359
|
+
| --------------- | ----------------------------------------------------------------------------- |
|
360
|
+
| IconButton | Use `skf-link` without text or `skf-button` variant tertiary, without a label |
|
361
|
+
| Search | Search is now a variant of `skf-input` |
|
362
|
+
| Image | Was deemed not adding value over the native `picture`/`img` tag |
|
363
|
+
| Paragraph | Was deemed not adding value over the native p tag |
|
364
|
+
| useTooltip | Not needed, `skf-tooltip` handles it common state internally |
|
365
|
+
| usePopup | Renamed `skf-popover`, no need for a hook |
|
366
|
+
| EmptyState | Missing but easy to copy svg from React and recreate |
|
367
|
+
| SkfUiProvider | Not needed, you add our global css as mentioned above |
|
368
|
+
| ToastProvider | `skf-toast` handles its own internal state, no provider needed |
|
369
|
+
| ts tokens | The global css contains all tokens as css custom vars which should suffice |
|
370
|
+
| Missing tokens | A few tokens are missing. Report as issue but expect to create your own |
|
371
|
+
|
354
372
|
## 🧑⚖️ License
|
355
373
|
|
356
374
|
Copyright SKF 2024
|
@@ -25,7 +25,7 @@ export declare class SkfAccordion extends SkfElement {
|
|
25
25
|
/** If true, will truncate all headings in collapsed state */
|
26
26
|
truncate: boolean;
|
27
27
|
/** @internal */
|
28
|
-
private
|
28
|
+
private _accordionItems;
|
29
29
|
protected updated(_changedProperties: PropertyValues): void;
|
30
30
|
/** @internal */
|
31
31
|
private get items();
|
@@ -22,7 +22,7 @@ const n = class n extends p {
|
|
22
22
|
}
|
23
23
|
/** @internal */
|
24
24
|
get items() {
|
25
|
-
return [...this
|
25
|
+
return [...this._accordionItems].filter((t) => t.localName === "skf-accordion-item");
|
26
26
|
}
|
27
27
|
_onChildToggle(t) {
|
28
28
|
if (this.multiple || t.defaultPrevented) return;
|
@@ -66,7 +66,7 @@ s([
|
|
66
66
|
], e.prototype, "truncate");
|
67
67
|
s([
|
68
68
|
d()
|
69
|
-
], e.prototype, "
|
69
|
+
], e.prototype, "_accordionItems");
|
70
70
|
export {
|
71
71
|
e as SkfAccordion
|
72
72
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import '../icon/icon.js';
|
2
2
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
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
|
/**
|
6
7
|
* The `<skf-alert>` is a type of notification that appears in-line
|
@@ -17,10 +18,10 @@ import { type CSSResultGroup } from 'lit';
|
|
17
18
|
export declare class SkfAlert extends SkfElement {
|
18
19
|
#private;
|
19
20
|
static styles: CSSResultGroup;
|
20
|
-
/** Close button aria-label */
|
21
|
-
buttonLabel: string;
|
22
21
|
/** If defined, displays leading icon */
|
23
22
|
icon?: Icon;
|
23
|
+
/** Sets the internal language of the component */
|
24
|
+
lang: Language;
|
24
25
|
/** If true, renders with an close button and sets aria-role to `status` */
|
25
26
|
persistent: boolean;
|
26
27
|
/** If defined, gives the supplied appearance */
|
@@ -1,28 +1,30 @@
|
|
1
1
|
var u = (t) => {
|
2
2
|
throw TypeError(t);
|
3
3
|
};
|
4
|
-
var
|
5
|
-
var
|
4
|
+
var g = (t, e, s) => e.has(t) || u("Cannot " + s);
|
5
|
+
var c = (t, e, s) => (g(t, e, "read from private field"), s ? s.call(t) : e.get(t)), h = (t, e, s) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), m = (t, e, s, o) => (g(t, e, "write to private field"), o ? o.call(t, s) : e.set(t, s), s);
|
6
6
|
import "../icon/icon.js";
|
7
|
-
import { SkfElement as
|
8
|
-
import { stateMap as
|
7
|
+
import { SkfElement as C } from "../../internal/components/skf-element.js";
|
8
|
+
import { stateMap as w } from "../../internal/helpers/stateMap.js";
|
9
9
|
import { watch as S } from "../../internal/helpers/watch.js";
|
10
10
|
import { componentStyles as $ } from "../../styles/component.styles.js";
|
11
|
-
import {
|
12
|
-
import {
|
11
|
+
import { LocalizeController as z } from "../../utilities/localize.js";
|
12
|
+
import { nothing as O, html as b } from "lit";
|
13
|
+
import { property as f } from "lit/decorators.js";
|
13
14
|
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
14
|
-
import { styles as
|
15
|
-
var
|
16
|
-
for (var i = o > 1 ? void 0 : o ?
|
17
|
-
(
|
18
|
-
return o && i &&
|
19
|
-
}, n, a;
|
20
|
-
const
|
15
|
+
import { styles as P } from "./alert.styles.js";
|
16
|
+
var k = Object.defineProperty, D = Object.getOwnPropertyDescriptor, p = (t, e, s, o) => {
|
17
|
+
for (var i = o > 1 ? void 0 : o ? D(e, s) : e, y = t.length - 1, d; y >= 0; y--)
|
18
|
+
(d = t[y]) && (i = (o ? d(e, s, i) : d(i)) || i);
|
19
|
+
return o && i && k(e, s, i), i;
|
20
|
+
}, n, a, l;
|
21
|
+
const v = class v extends C {
|
21
22
|
constructor() {
|
22
23
|
super(...arguments);
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
h(this, n);
|
25
|
+
h(this, a);
|
26
|
+
h(this, l);
|
27
|
+
m(this, n, new z(this)), m(this, a, this.attachInternals()), m(this, l, c(this, a).states), this.lang = "en", this.persistent = !1, this._handleClose = () => {
|
26
28
|
this.emit("skf-alert-close");
|
27
29
|
};
|
28
30
|
}
|
@@ -31,10 +33,10 @@ const b = class b extends g {
|
|
31
33
|
}
|
32
34
|
_handleStateChange() {
|
33
35
|
const s = ["error", "info", "success", "warning"];
|
34
|
-
|
36
|
+
w(c(this, l), s).set(this.severity);
|
35
37
|
}
|
36
38
|
render() {
|
37
|
-
return
|
39
|
+
return b`
|
38
40
|
<div id="root">
|
39
41
|
<skf-icon
|
40
42
|
color=${_(this.severity ?? "secondary")}
|
@@ -45,30 +47,34 @@ const b = class b extends g {
|
|
45
47
|
<slot id="main"></slot>
|
46
48
|
<slot name="link"></slot>
|
47
49
|
</div>
|
48
|
-
${this.persistent ?
|
49
|
-
<button
|
50
|
+
${this.persistent ? b`
|
51
|
+
<button
|
52
|
+
@click="${this._handleClose}"
|
53
|
+
aria-label=${c(this, n).term("close")}
|
54
|
+
type="button"
|
55
|
+
>
|
50
56
|
<skf-icon name="close" size="sm"></skf-icon>
|
51
57
|
</button>
|
52
|
-
` :
|
58
|
+
` : O}
|
53
59
|
</div>
|
54
60
|
`;
|
55
61
|
}
|
56
62
|
};
|
57
|
-
n = new WeakMap(), a = new WeakMap(),
|
58
|
-
let r =
|
59
|
-
|
60
|
-
|
61
|
-
], r.prototype, "buttonLabel", 2);
|
62
|
-
l([
|
63
|
-
p({ type: String })
|
63
|
+
n = new WeakMap(), a = new WeakMap(), l = new WeakMap(), v.styles = [$, P];
|
64
|
+
let r = v;
|
65
|
+
p([
|
66
|
+
f({ type: String })
|
64
67
|
], r.prototype, "icon", 2);
|
65
|
-
|
66
|
-
|
68
|
+
p([
|
69
|
+
f({ type: String })
|
70
|
+
], r.prototype, "lang", 2);
|
71
|
+
p([
|
72
|
+
f({ type: Boolean })
|
67
73
|
], r.prototype, "persistent", 2);
|
68
|
-
|
69
|
-
|
74
|
+
p([
|
75
|
+
f({ type: String })
|
70
76
|
], r.prototype, "severity", 2);
|
71
|
-
|
77
|
+
p([
|
72
78
|
S("severity")
|
73
79
|
], r.prototype, "_handleStateChange", 1);
|
74
80
|
export {
|
@@ -86,9 +86,9 @@ const r = o`
|
|
86
86
|
--_skf-button-bg-color: var(--skf-interactive-bg-color-secondary);
|
87
87
|
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
|
88
88
|
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
|
89
|
-
--_skf-button-border-color: var(--skf-border-color-
|
89
|
+
--_skf-button-border-color: var(--skf-border-color-emphasized);
|
90
90
|
--_skf-button-border-color-disabled: var(--skf-interactive-border-color-disabled);
|
91
|
-
--_skf-button-color: var(--skf-text-color-
|
91
|
+
--_skf-button-color: var(--skf-text-color-emphasized);
|
92
92
|
--_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
|
93
93
|
}
|
94
94
|
|
@@ -97,7 +97,7 @@ const r = o`
|
|
97
97
|
--_skf-button-bg-color-active: var(--skf-interactive-bg-color-secondary-active);
|
98
98
|
--_skf-button-bg-color-hover: var(--skf-interactive-bg-color-secondary-hover);
|
99
99
|
--_skf-button-border-color: transparent;
|
100
|
-
--_skf-button-color: var(--skf-text-color-
|
100
|
+
--_skf-button-color: var(--skf-text-color-emphasized);
|
101
101
|
--_skf-button-color-disabled: var(--skf-interactive-text-color-disabled);
|
102
102
|
}
|
103
103
|
|
@@ -2,6 +2,7 @@ import '../icon/icon.js';
|
|
2
2
|
import { FormBase } from '../../internal/components/formBase.js';
|
3
3
|
import type { FormFieldSeverity } from '../../internal/types.js';
|
4
4
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
5
|
+
import { type Language } from '../../utilities/localize.js';
|
5
6
|
import { type CSSResultGroup } from 'lit';
|
6
7
|
/**
|
7
8
|
* The `<skf-checkbox>` component is used to create a checkbox input
|
@@ -18,6 +19,7 @@ import { type CSSResultGroup } from 'lit';
|
|
18
19
|
* @tagname skf-checkbox
|
19
20
|
*/
|
20
21
|
export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps {
|
22
|
+
#private;
|
21
23
|
static styles: CSSResultGroup;
|
22
24
|
/**
|
23
25
|
* @internal
|
@@ -35,10 +37,10 @@ export declare class SkfCheckbox extends FormBase implements FormFieldBaseProps
|
|
35
37
|
indeterminate: boolean;
|
36
38
|
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
37
39
|
label?: string;
|
40
|
+
/** Sets the internal language of the component */
|
41
|
+
lang: Language;
|
38
42
|
/** If defined, adds name to the input-element */
|
39
43
|
name?: string;
|
40
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
41
|
-
requiredLabel?: string;
|
42
44
|
/** If defined, styles checkbox using provided severity */
|
43
45
|
severity?: FormFieldSeverity;
|
44
46
|
/** If true, displays valid state after interaction */
|
@@ -1,22 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { watch as h } from "../../internal/helpers/watch.js";
|
4
|
-
import { Asterisk as v } from "../../internal/templates/asterisk.js";
|
5
|
-
import { componentStyles as m } from "../../styles/component.styles.js";
|
6
|
-
import { html as c, nothing as f } from "lit";
|
7
|
-
import { property as r, state as y, query as g } from "lit/decorators.js";
|
8
|
-
import { ifDefined as _ } from "lit/directives/if-defined.js";
|
9
|
-
import { styles as b } from "./checkbox.styles.js";
|
10
|
-
var k = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, i = (u, t, s, a) => {
|
11
|
-
for (var l = a > 1 ? void 0 : a ? $(t, s) : t, n = u.length - 1, o; n >= 0; n--)
|
12
|
-
(o = u[n]) && (l = (a ? o(t, s, l) : o(l)) || l);
|
13
|
-
return a && l && k(t, s, l), l;
|
1
|
+
var p = (i) => {
|
2
|
+
throw TypeError(i);
|
14
3
|
};
|
15
|
-
|
4
|
+
var v = (i, s, t) => s.has(i) || p("Cannot " + t);
|
5
|
+
var m = (i, s, t) => (v(i, s, "read from private field"), t ? t.call(i) : s.get(i)), f = (i, s, t) => s.has(i) ? p("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, t), y = (i, s, t, a) => (v(i, s, "write to private field"), a ? a.call(i, t) : s.set(i, t), t);
|
6
|
+
import "../icon/icon.js";
|
7
|
+
import { FormBase as _ } from "../../internal/components/formBase.js";
|
8
|
+
import { watch as o } from "../../internal/helpers/watch.js";
|
9
|
+
import { Asterisk as b } from "../../internal/templates/asterisk.js";
|
10
|
+
import { componentStyles as k } from "../../styles/component.styles.js";
|
11
|
+
import { LocalizeController as $ } from "../../utilities/localize.js";
|
12
|
+
import { html as g, nothing as I } from "lit";
|
13
|
+
import { property as l, state as V, query as C } from "lit/decorators.js";
|
14
|
+
import { ifDefined as E } from "lit/directives/if-defined.js";
|
15
|
+
import { styles as w } from "./checkbox.styles.js";
|
16
|
+
var A = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (i, s, t, a) => {
|
17
|
+
for (var h = a > 1 ? void 0 : a ? D(s, t) : s, d = i.length - 1, u; d >= 0; d--)
|
18
|
+
(u = i[d]) && (h = (a ? u(s, t, h) : u(h)) || h);
|
19
|
+
return a && h && A(s, t, h), h;
|
20
|
+
}, n;
|
21
|
+
const c = class c extends _ {
|
16
22
|
constructor() {
|
17
|
-
super(...arguments)
|
23
|
+
super(...arguments);
|
24
|
+
f(this, n);
|
25
|
+
this._initiallyChecked = !1, y(this, n, new $(this)), this.debug = !1, this.customInvalid = !1, this.indeterminate = !1, this.lang = "en", this.showValid = !1, this.size = "md", this.value = "", this._invalid = !1, this._resetValue = (t) => {
|
18
26
|
t.stopPropagation(), this.checked = this._initiallyChecked, this.$input && (this.$input.checked = !!this._initiallyChecked), this.setFormValue(this.checked ? this.value : null);
|
19
|
-
}, this._renderIcon = (t) =>
|
27
|
+
}, this._renderIcon = (t) => g`
|
20
28
|
<skf-icon color="inverse" name=${t} size=${this.size === "sm" ? "sm" : "md"}></skf-icon>
|
21
29
|
`;
|
22
30
|
}
|
@@ -38,21 +46,21 @@ const d = class d extends p {
|
|
38
46
|
}
|
39
47
|
handleCustomInvalidChange() {
|
40
48
|
if (this.customInvalid) {
|
41
|
-
const
|
49
|
+
const a = (
|
42
50
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
43
51
|
this.getAttribute("data-customerror") || "Set a custom error message using the data-customerror attribute"
|
44
52
|
);
|
45
|
-
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 },
|
53
|
+
this.pristine = !1, this._invalid = !0, this.setValidity({ customError: !0 }, a), this.checkValidity();
|
46
54
|
} else
|
47
55
|
this.setValidity({}), this._validateInput();
|
48
56
|
}
|
49
57
|
firstUpdated() {
|
50
58
|
var t;
|
51
|
-
(t = this.$input) == null || t.addEventListener("change", (
|
52
|
-
var
|
53
|
-
|
54
|
-
}), this.addEventListener("invalid", (
|
55
|
-
this.pristine = !1, this._invalid = !0, this.customErrorDisplay &&
|
59
|
+
(t = this.$input) == null || t.addEventListener("change", (a) => {
|
60
|
+
var h;
|
61
|
+
a.stopPropagation(), this.pristine = !1, this.checked = ((h = this.$input) == null ? void 0 : h.checked) ?? !1, this._validateInput(), this.checked ? (this.indeterminate = !1, this.setFormValue(this.value)) : this.setFormValue(null), this.emitEvent("change");
|
62
|
+
}), this.addEventListener("invalid", (a) => {
|
63
|
+
this.pristine = !1, this._invalid = !0, this.customErrorDisplay && a.preventDefault();
|
56
64
|
}), this._initiallyChecked = this.checked, this.addEventListener("reset", this._resetValue), this._validateInput();
|
57
65
|
}
|
58
66
|
/** @internal */
|
@@ -62,16 +70,16 @@ const d = class d extends p {
|
|
62
70
|
this.setValidity({ customError: !0 }, "Custom error"), this._invalid = !0;
|
63
71
|
else if (this.required && !this.checked) {
|
64
72
|
this.pristine || (this._invalid = !0);
|
65
|
-
const
|
73
|
+
const a = this.hasAttribute("data-valuemissing") ? this.getAttribute("data-valuemissing") : (
|
66
74
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
67
75
|
((t = this.$input) == null ? void 0 : t.validationMessage) || "Please check this box if you want to proceed"
|
68
76
|
);
|
69
|
-
this.setValidity({ valueMissing: !0 }, String(
|
77
|
+
this.setValidity({ valueMissing: !0 }, String(a));
|
70
78
|
} else
|
71
79
|
this.setValidity({});
|
72
80
|
}
|
73
81
|
render() {
|
74
|
-
return
|
82
|
+
return g`
|
75
83
|
<label id="root">
|
76
84
|
<input
|
77
85
|
?checked=${this.checked}
|
@@ -79,71 +87,71 @@ const d = class d extends p {
|
|
79
87
|
?required=${this.required}
|
80
88
|
.indeterminate=${this.indeterminate}
|
81
89
|
aria-invalid=${!!this._invalid}
|
82
|
-
name=${
|
90
|
+
name=${E(this.name)}
|
83
91
|
type="checkbox"
|
84
92
|
value=${this.value}
|
85
93
|
/>
|
86
94
|
${this._renderIcon("check")} ${this._renderIcon("removeMinus")}
|
87
95
|
<div id="label">
|
88
96
|
<slot>${this.label}</slot>
|
89
|
-
${this.required ?
|
97
|
+
${this.required ? b(m(this, n).term("required")) : I}
|
90
98
|
</div>
|
91
99
|
</label>
|
92
100
|
`;
|
93
101
|
}
|
94
102
|
};
|
95
|
-
|
96
|
-
let e =
|
97
|
-
|
98
|
-
|
103
|
+
n = new WeakMap(), c.styles = [k, w];
|
104
|
+
let e = c;
|
105
|
+
r([
|
106
|
+
l({ type: Boolean })
|
99
107
|
], e.prototype, "debug", 2);
|
100
|
-
|
101
|
-
|
108
|
+
r([
|
109
|
+
l({ type: Boolean, reflect: !0 })
|
102
110
|
], e.prototype, "checked", 1);
|
103
|
-
|
104
|
-
|
111
|
+
r([
|
112
|
+
l({ type: Boolean, attribute: "custom-invalid", reflect: !0 })
|
105
113
|
], e.prototype, "customInvalid", 2);
|
106
|
-
|
107
|
-
|
114
|
+
r([
|
115
|
+
l({ type: Boolean, reflect: !0 })
|
108
116
|
], e.prototype, "indeterminate", 2);
|
109
|
-
|
110
|
-
|
117
|
+
r([
|
118
|
+
l()
|
111
119
|
], e.prototype, "label", 2);
|
112
|
-
|
113
|
-
|
120
|
+
r([
|
121
|
+
l({ type: String })
|
122
|
+
], e.prototype, "lang", 2);
|
123
|
+
r([
|
124
|
+
l()
|
114
125
|
], e.prototype, "name", 2);
|
115
|
-
|
116
|
-
|
117
|
-
], e.prototype, "requiredLabel", 2);
|
118
|
-
i([
|
119
|
-
r({ reflect: !0 })
|
126
|
+
r([
|
127
|
+
l({ reflect: !0 })
|
120
128
|
], e.prototype, "severity", 2);
|
121
|
-
|
122
|
-
|
129
|
+
r([
|
130
|
+
l({ type: Boolean, attribute: "show-valid" })
|
123
131
|
], e.prototype, "showValid", 2);
|
124
|
-
|
125
|
-
|
132
|
+
r([
|
133
|
+
l({ reflect: !0 })
|
126
134
|
], e.prototype, "size", 2);
|
127
|
-
|
128
|
-
|
135
|
+
r([
|
136
|
+
l()
|
129
137
|
], e.prototype, "value", 2);
|
130
|
-
|
131
|
-
|
138
|
+
r([
|
139
|
+
V()
|
132
140
|
], e.prototype, "_invalid", 2);
|
133
|
-
|
134
|
-
|
141
|
+
r([
|
142
|
+
C("input")
|
135
143
|
], e.prototype, "$input", 2);
|
136
|
-
|
137
|
-
|
144
|
+
r([
|
145
|
+
o("checked", { afterUpdate: !0 })
|
138
146
|
], e.prototype, "handleCheckedChange", 1);
|
139
|
-
|
140
|
-
|
147
|
+
r([
|
148
|
+
o("_invalid")
|
141
149
|
], e.prototype, "handleInvalidChange", 1);
|
142
|
-
|
143
|
-
|
150
|
+
r([
|
151
|
+
o("_invalid", { afterUpdate: !0 })
|
144
152
|
], e.prototype, "handleDebugInvalid", 1);
|
145
|
-
|
146
|
-
|
153
|
+
r([
|
154
|
+
o("customInvalid")
|
147
155
|
], e.prototype, "handleCustomInvalidChange", 1);
|
148
156
|
export {
|
149
157
|
e as SkfCheckbox
|
@@ -43,7 +43,7 @@ const i = [
|
|
43
43
|
}
|
44
44
|
|
45
45
|
&:is(:checked:not(:disabled), :indeterminate:not(:disabled)) {
|
46
|
-
--_skf-checkbox-bg-color: var(--skf-bg-color-
|
46
|
+
--_skf-checkbox-bg-color: var(--skf-bg-color-emphasized);
|
47
47
|
--_skf-checkbox-border-color: transparent;
|
48
48
|
}
|
49
49
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
2
2
|
import { Temporal } from '@js-temporal/polyfill';
|
3
|
+
import { type Language } from '../../utilities/localize.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
5
|
interface DateParts {
|
5
6
|
year?: number;
|
@@ -10,6 +11,7 @@ interface DateParts {
|
|
10
11
|
* @tagname skf-datepicker-calendar
|
11
12
|
*/
|
12
13
|
export declare class SkfDatepickerCalendar extends SkfElement {
|
14
|
+
#private;
|
13
15
|
static styles: CSSResultGroup;
|
14
16
|
/** @internal */
|
15
17
|
_secondCalendarOffset: number;
|
@@ -21,6 +23,8 @@ export declare class SkfDatepickerCalendar extends SkfElement {
|
|
21
23
|
* A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.
|
22
24
|
*/
|
23
25
|
invalidDates?: string;
|
26
|
+
/** Sets the internal language of the component */
|
27
|
+
lang: Language;
|
24
28
|
locale: string;
|
25
29
|
range: boolean;
|
26
30
|
/**
|