@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.11
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 +25 -1
- package/dist/components/accordion/accordion-item.component.js +49 -38
- package/dist/components/accordion/accordion.component.d.ts +2 -2
- package/dist/components/accordion/accordion.component.js +12 -12
- package/dist/components/alert/alert.component.d.ts +8 -3
- package/dist/components/alert/alert.component.js +59 -50
- package/dist/components/alert/alert.styles.js +51 -47
- package/dist/components/breadcrumb/breadcrumb-item.component.js +30 -32
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.styles.js +16 -15
- package/dist/components/breadcrumb/breadcrumb.component.d.ts +5 -2
- package/dist/components/breadcrumb/breadcrumb.component.js +51 -46
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.styles.js +13 -10
- package/dist/components/button/button.component.js +63 -67
- package/dist/components/button/button.styles.js +5 -4
- package/dist/components/card/card.component.d.ts +5 -0
- package/dist/components/card/card.component.js +46 -24
- package/dist/components/card/card.styles.js +31 -14
- package/dist/components/checkbox/checkbox.component.d.ts +6 -5
- package/dist/components/checkbox/checkbox.component.js +67 -69
- package/dist/components/checkbox/checkbox.styles.js +1 -1
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +8 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +109 -115
- package/dist/components/datepicker/datepicker-calendar.d.ts +8 -0
- package/dist/components/datepicker/datepicker-calendar.js +6 -0
- package/dist/components/{date-picker/datepicker.component.d.ts → datepicker/datepicker-popup.component.d.ts} +9 -20
- package/dist/components/datepicker/datepicker-popup.component.js +272 -0
- package/dist/components/datepicker/datepicker-popup.d.ts +8 -0
- package/dist/components/{date-picker/datepicker.helpers.d.ts → datepicker/datepicker-popup.helpers.d.ts} +3 -3
- package/dist/components/datepicker/datepicker-popup.helpers.js +83 -0
- package/dist/components/datepicker/datepicker-popup.js +6 -0
- package/dist/components/{date-picker/datepicker.styles.js → datepicker/datepicker-popup.styles.js} +3 -3
- package/dist/components/{date-picker-input/datepicker-input.component.d.ts → datepicker/datepicker.component.d.ts} +21 -14
- package/dist/components/datepicker/datepicker.component.js +455 -0
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.d.ts +3 -2
- package/dist/components/dialog/dialog.component.js +49 -49
- package/dist/components/dialog/dialog.d.ts +2 -2
- 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 +12 -4
- package/dist/components/drawer/drawer.component.js +84 -61
- package/dist/components/drawer/drawer.d.ts +2 -2
- 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 +64 -57
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/header/header.styles.js +2 -2
- package/dist/components/heading/heading.component.d.ts +5 -1
- package/dist/components/heading/heading.component.js +54 -27
- package/dist/components/heading/heading.styles.js +34 -36
- package/dist/components/icon/icon.component.d.ts +4 -0
- package/dist/components/icon/icon.component.js +62 -43
- package/dist/components/icon/icon.styles.js +60 -60
- package/dist/components/input/input.component.d.ts +4 -8
- package/dist/components/input/input.component.js +90 -97
- package/dist/components/input/input.controllers.d.ts +0 -1
- package/dist/components/input/input.controllers.js +14 -19
- package/dist/components/link/link.component.d.ts +16 -18
- package/dist/components/link/link.component.js +109 -106
- package/dist/components/link/link.styles.js +49 -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/logo/logo.component.d.ts +4 -1
- package/dist/components/logo/logo.component.js +55 -51
- package/dist/components/logo/logo.styles.js +26 -16
- 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.d.ts +2 -2
- 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/menu/menu.d.ts +2 -2
- package/dist/components/nav/nav-item.component.d.ts +6 -2
- 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.d.ts +2 -2
- 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/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.component.d.ts +2 -0
- package/dist/components/progress/progress.component.js +38 -29
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +10 -8
- package/dist/components/radio/radio.component.d.ts +4 -2
- package/dist/components/radio/radio.component.js +96 -91
- 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.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button-item.styles.js +1 -1
- package/dist/components/segmented-button/segmented-button.component.js +22 -24
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- 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.d.ts +2 -2
- package/dist/components/select/select-option-group.style.js +12 -6
- package/dist/components/select/select-option.component.d.ts +9 -4
- package/dist/components/select/select-option.component.js +70 -58
- package/dist/components/select/select-option.styles.js +43 -31
- package/dist/components/select/select.component.d.ts +21 -12
- package/dist/components/select/select.component.js +125 -87
- package/dist/components/select/select.controllers.js +15 -20
- 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 +59 -56
- package/dist/components/stepper/stepper-item.d.ts +2 -2
- package/dist/components/stepper/stepper-item.styles.js +4 -4
- package/dist/components/stepper/stepper.component.js +2 -3
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/stepper/stepper.helpers.js +6 -7
- package/dist/components/switch/switch.component.d.ts +4 -2
- package/dist/components/switch/switch.component.js +64 -58
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/switch/switch.styles.js +1 -1
- package/dist/components/{tab-panel → tabs}/tab-panel.component.d.ts +1 -1
- package/dist/components/tabs/tab-panel.component.js +39 -0
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +3 -3
- package/dist/components/{tab → tabs}/tab.component.js +17 -14
- package/dist/components/{tab → tabs}/tab.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.styles.js +2 -2
- package/dist/components/{tab-group/tab-group.component.d.ts → tabs/tabs.component.d.ts} +3 -4
- package/dist/components/{tab-group/tab-group.component.js → tabs/tabs.component.js} +35 -36
- package/dist/components/tabs/tabs.d.ts +8 -0
- package/dist/components/tabs/tabs.js +6 -0
- package/dist/components/{tab-group/tab-group.styles.js → tabs/tabs.styles.js} +16 -16
- package/dist/components/tag/tag.component.d.ts +10 -2
- package/dist/components/tag/tag.component.js +77 -65
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/textarea/textarea.component.d.ts +4 -2
- package/dist/components/textarea/textarea.component.js +102 -95
- 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 +19 -20
- package/dist/components/tooltip/tooltip.component.d.ts +9 -2
- package/dist/components/tooltip/tooltip.component.js +15 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +1699 -1112
- package/dist/index.d.ts +8 -7
- package/dist/index.js +96 -93
- package/dist/internal/base-classes/popover/popover.base.d.ts +24 -5
- package/dist/internal/base-classes/popover/popover.base.js +41 -44
- package/dist/internal/base-classes/popover/popover.styles.js +4 -5
- package/dist/internal/components/formBase.d.ts +1 -0
- package/dist/internal/components/formBase.js +11 -19
- 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/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/internal/controllers/popover.controller.d.ts +2 -0
- package/dist/internal/controllers/popover.controller.js +11 -14
- package/dist/internal/helpers/stateMap.d.ts +14 -0
- package/dist/internal/helpers/stateMap.js +68 -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/helpers/watch.js +12 -12
- 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/component.styles.js +37 -36
- package/dist/styles/global-alt.css +1 -0
- 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 +1990 -866
- package/dist/types/vue/index.d.ts +220 -169
- package/dist/utilities/localize.d.ts +28 -0
- package/dist/utilities/localize.js +13 -0
- package/dist/vscode.html-custom-data.json +265 -188
- package/dist/web-types.json +731 -548
- package/package.json +39 -51
- package/dist/components/accordion/accordion-item.test.d.ts +0 -1
- package/dist/components/accordion/accordion.test.d.ts +0 -1
- package/dist/components/checkbox/checkbox.test.d.ts +0 -1
- package/dist/components/date-picker/datepicker.component.js +0 -261
- package/dist/components/date-picker/datepicker.d.ts +0 -10
- package/dist/components/date-picker/datepicker.helpers.js +0 -76
- package/dist/components/date-picker/datepicker.js +0 -8
- package/dist/components/date-picker-input/datepicker-input.component.js +0 -442
- package/dist/components/date-picker-input/datepicker-input.d.ts +0 -8
- package/dist/components/date-picker-input/datepicker-input.js +0 -6
- package/dist/components/input/input.test.d.ts +0 -1
- package/dist/components/radio/radio.test.d.ts +0 -1
- package/dist/components/switch/switch.test.d.ts +0 -1
- package/dist/components/tab-group/tab-group.d.ts +0 -8
- package/dist/components/tab-group/tab-group.js +0 -6
- package/dist/components/tab-panel/tab-panel.component.js +0 -36
- package/dist/internal/playwright/index.d.ts +0 -1
- /package/dist/components/{date-picker/datepicker.calendar.styles.d.ts → datepicker/datepicker-calendar.styles.d.ts} +0 -0
- /package/dist/components/{date-picker/datepicker.calendar.styles.js → datepicker/datepicker-calendar.styles.js} +0 -0
- /package/dist/components/{date-picker/datepicker.styles.d.ts → datepicker/datepicker-popup.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.d.ts → datepicker/datepicker.helpers.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.helpers.js → datepicker/datepicker.helpers.js} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.d.ts → datepicker/datepicker.styles.d.ts} +0 -0
- /package/dist/components/{date-picker-input/datepicker-input.styles.js → datepicker/datepicker.styles.js} +0 -0
- /package/dist/components/select/{select.stories.icons.d.ts → stories/select.stories.icons.d.ts} +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.js +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.styles.js +0 -0
- /package/dist/components/{tab → tabs}/tab.js +0 -0
- /package/dist/components/{tab → tabs}/tab.styles.d.ts +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -1,51 +1,70 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { componentStyles as d } from "../../styles/component.styles.js";
|
4
|
-
import { html as h } from "lit";
|
5
|
-
import { property as t } from "lit/decorators.js";
|
6
|
-
import { classMap as u } from "lit/directives/class-map.js";
|
7
|
-
import { ifDefined as s } from "lit/directives/if-defined.js";
|
8
|
-
import { styles as v } from "./icon.styles.js";
|
9
|
-
var y = Object.defineProperty, o = (m, p, a, $) => {
|
10
|
-
for (var r = void 0, i = m.length - 1, n; i >= 0; i--)
|
11
|
-
(n = m[i]) && (r = n(p, a, r) || r);
|
12
|
-
return r && y(p, a, r), r;
|
1
|
+
var u = (t) => {
|
2
|
+
throw TypeError(t);
|
13
3
|
};
|
14
|
-
|
4
|
+
var g = (t, e, r) => e.has(t) || u("Cannot " + r);
|
5
|
+
var c = (t, e, r) => (g(t, e, "read from private field"), r ? r.call(t) : e.get(t)), y = (t, e, r) => e.has(t) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), d = (t, e, r, o) => (g(t, e, "write to private field"), o ? o.call(t, r) : e.set(t, r), r);
|
6
|
+
import { SkfElement as v } from "../../internal/components/skf-element.js";
|
7
|
+
import { stateMap as b } from "../../internal/helpers/stateMap.js";
|
8
|
+
import { watch as _ } from "../../internal/helpers/watch.js";
|
9
|
+
import { ICONS as S } from "@skf-design-system/ui-assets";
|
10
|
+
import { componentStyles as C } from "../../styles/component.styles.js";
|
11
|
+
import { html as z } from "lit";
|
12
|
+
import { property as n } from "lit/decorators.js";
|
13
|
+
import { styles as O } from "./icon.styles.js";
|
14
|
+
var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (t, e, r, o) => {
|
15
|
+
for (var s = o > 1 ? void 0 : o ? P(e, r) : e, m = t.length - 1, h; m >= 0; m--)
|
16
|
+
(h = t[m]) && (s = (o ? h(e, r, s) : h(s)) || s);
|
17
|
+
return o && s && w(e, r, s), s;
|
18
|
+
};
|
19
|
+
const x = {
|
20
|
+
color: [
|
21
|
+
"emphasized",
|
22
|
+
"error",
|
23
|
+
"info",
|
24
|
+
"inverse",
|
25
|
+
"primary",
|
26
|
+
"purple",
|
27
|
+
"secondary",
|
28
|
+
"success",
|
29
|
+
"warning"
|
30
|
+
],
|
31
|
+
size: ["lg", "md", "sm", "xs"]
|
32
|
+
};
|
33
|
+
var a, p;
|
34
|
+
const f = class f extends v {
|
15
35
|
constructor() {
|
16
|
-
super(...arguments)
|
36
|
+
super(...arguments);
|
37
|
+
y(this, a);
|
38
|
+
y(this, p);
|
39
|
+
d(this, a, this.attachInternals()), d(this, p, c(this, a).states), this.color = "primary", this.size = "md";
|
40
|
+
}
|
41
|
+
connectedCallback() {
|
42
|
+
super.connectedCallback(), this.ariaHidden = this.label ? null : "true", this.ariaLabel = this.label ?? null, this.role = this.label ? "img" : null;
|
43
|
+
}
|
44
|
+
_handleStateChange(r, o, s) {
|
45
|
+
b(c(this, p), x[r]).set(s);
|
17
46
|
}
|
18
47
|
render() {
|
19
|
-
return
|
20
|
-
<div
|
21
|
-
aria-hidden=${s(this.label ? void 0 : "true")}
|
22
|
-
aria-label=${s(this.label)}
|
23
|
-
class=${u({
|
24
|
-
icon: !0,
|
25
|
-
[`icon--color-${this.color}`]: !0,
|
26
|
-
[`icon--size-${this.size}`]: !0
|
27
|
-
})}
|
28
|
-
role=${s(this.label ? "img" : void 0)}
|
29
|
-
>
|
30
|
-
${c[this.name]}
|
31
|
-
</div>
|
32
|
-
`;
|
48
|
+
return z`<div id="root">${S[this.name]}</div>`;
|
33
49
|
}
|
34
50
|
};
|
35
|
-
|
36
|
-
let
|
37
|
-
|
38
|
-
|
39
|
-
],
|
40
|
-
|
41
|
-
|
42
|
-
],
|
43
|
-
|
44
|
-
|
45
|
-
],
|
46
|
-
|
47
|
-
|
48
|
-
],
|
51
|
+
a = new WeakMap(), p = new WeakMap(), f.styles = [C, O];
|
52
|
+
let i = f;
|
53
|
+
l([
|
54
|
+
n({ type: String })
|
55
|
+
], i.prototype, "color", 2);
|
56
|
+
l([
|
57
|
+
n({ type: String })
|
58
|
+
], i.prototype, "label", 2);
|
59
|
+
l([
|
60
|
+
n({ type: String })
|
61
|
+
], i.prototype, "name", 2);
|
62
|
+
l([
|
63
|
+
n({ type: String })
|
64
|
+
], i.prototype, "size", 2);
|
65
|
+
l([
|
66
|
+
_(["color", "size"])
|
67
|
+
], i.prototype, "_handleStateChange", 1);
|
49
68
|
export {
|
50
|
-
|
69
|
+
i as SkfIcon
|
51
70
|
};
|
@@ -1,84 +1,84 @@
|
|
1
1
|
import { css as o } from "lit";
|
2
|
-
const
|
3
|
-
/* stylelint-disable selector-class-pattern */
|
2
|
+
const r = o`
|
4
3
|
@layer components {
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
@layer base {
|
5
|
+
:host {
|
6
|
+
display: inline-flex;
|
7
|
+
}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
#root {
|
10
|
+
--_skf-icon-color: var(--skf-icon-color-primary);
|
11
|
+
--_skf-icon-size: var(--skf-icon-size-md);
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
pointer-events: none;
|
19
|
-
user-select: none;
|
13
|
+
block-size: var(--_skf-icon-size);
|
14
|
+
flex-shrink: 0; /* Prevents shrink when flex-child */
|
15
|
+
inline-size: var(--_skf-icon-size);
|
16
|
+
pointer-events: none;
|
17
|
+
user-select: none;
|
20
18
|
|
21
|
-
|
22
|
-
|
19
|
+
:host(:not([data-color='custom'])) & {
|
20
|
+
color: var(--_skf-icon-color);
|
21
|
+
}
|
23
22
|
}
|
24
23
|
}
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
@layer mods {
|
26
|
+
/**
|
27
|
+
* Color
|
28
|
+
*/
|
29
|
+
:host([data-color='custom']) {
|
30
|
+
color: inherit;
|
31
|
+
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
:host(:state(secondary)) #root {
|
34
|
+
--_skf-icon-color: var(--skf-icon-color-secondary);
|
35
|
+
}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
:host(:state(inverse)) #root {
|
38
|
+
--_skf-icon-color: var(--skf-icon-color-inverse);
|
39
|
+
}
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
41
|
+
:host(:state(emphasized)) #root {
|
42
|
+
--_skf-icon-color: var(--skf-icon-color-emphasized);
|
43
|
+
}
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
:host(:state(purple)) #root {
|
46
|
+
--_skf-icon-color: var(--skf-icon-color-purple);
|
47
|
+
}
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
:host(:state(error)) #root {
|
50
|
+
--_skf-icon-color: var(--skf-severity-fg-color-error);
|
51
|
+
}
|
53
52
|
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
:host(:state(info)) #root {
|
54
|
+
--_skf-icon-color: var(--skf-severity-fg-color-info);
|
55
|
+
}
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
:host(:state(success)) #root {
|
58
|
+
--_skf-icon-color: var(--skf-severity-fg-color-success);
|
59
|
+
}
|
61
60
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
.icon--size-xs {
|
66
|
-
--_skf-icon-size: var(--skf-icon-size-xs);
|
67
|
-
}
|
61
|
+
:host(:state(warning)) #root {
|
62
|
+
--_skf-icon-color: var(--skf-severity-fg-color-warning);
|
63
|
+
}
|
68
64
|
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
/**
|
66
|
+
* Size
|
67
|
+
*/
|
68
|
+
:host(:state(xs)) #root {
|
69
|
+
--_skf-icon-size: var(--skf-icon-size-xs);
|
70
|
+
}
|
72
71
|
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
:host(:state(sm)) #root {
|
73
|
+
--_skf-icon-size: var(--skf-icon-size-sm);
|
74
|
+
}
|
76
75
|
|
77
|
-
|
78
|
-
|
76
|
+
:host(:state(lg)) #root {
|
77
|
+
--_skf-icon-size: var(--skf-icon-size-lg);
|
78
|
+
}
|
79
79
|
}
|
80
80
|
}
|
81
81
|
`;
|
82
82
|
export {
|
83
|
-
|
83
|
+
r as styles
|
84
84
|
};
|
@@ -3,6 +3,7 @@ import { FormBase } from '../../internal/components/formBase.js';
|
|
3
3
|
import '../../internal/components/hint/hint';
|
4
4
|
import type { FormFieldSeverity } from '../../internal/types.js';
|
5
5
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
6
|
+
import { type Language } from '../../utilities/localize.js';
|
6
7
|
import { type CSSResultGroup } from 'lit';
|
7
8
|
/**
|
8
9
|
* The skf-text-field is used to create a text input field. It can be used inside a form element or standalone
|
@@ -23,6 +24,7 @@ import { type CSSResultGroup } from 'lit';
|
|
23
24
|
* behaviour: validate-on-input, validate-on-submit and native-validation
|
24
25
|
*/
|
25
26
|
export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
27
|
+
#private;
|
26
28
|
static styles: CSSResultGroup;
|
27
29
|
private customError;
|
28
30
|
/** @internal intermediary value for reset to function, e.g value attribute act as default value */
|
@@ -32,12 +34,6 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
32
34
|
* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/autocomplete) for details.
|
33
35
|
*/
|
34
36
|
autocomplete?: HTMLInputElement['autocomplete'];
|
35
|
-
/** Custom aria-label for the clear button. **Notice!** Only applicable to type=search. */
|
36
|
-
buttonAriaLabelClear: string;
|
37
|
-
/** Custom aria-label for the visibility button. **Notice!** Only applicable to type=password. */
|
38
|
-
buttonAriaLabelHide: string;
|
39
|
-
/** Custom aria-label for the visibility button **Notice!** Only applicable to type=password. */
|
40
|
-
buttonAriaLabelShow: string;
|
41
37
|
/** If defined, forces component to invalid state until removed. Its value is used as hint text. */
|
42
38
|
set customInvalid(value: string | undefined);
|
43
39
|
get customInvalid(): string | undefined;
|
@@ -54,6 +50,8 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
54
50
|
inputmode: HTMLInputElement['inputMode'];
|
55
51
|
/** If defined, sets the input's label. Alternatively, you can use the `label` attribute. */
|
56
52
|
label?: string;
|
53
|
+
/** Sets the internal language of the component */
|
54
|
+
lang: Language;
|
57
55
|
/** If defined, displays a prefix/adornment before the input-element */
|
58
56
|
leading?: string;
|
59
57
|
/** If defined, sets the maximum value to accept for this input */
|
@@ -72,8 +70,6 @@ export declare class SkfInput extends FormBase implements FormFieldBaseProps {
|
|
72
70
|
placeholder?: string;
|
73
71
|
/** If true, makes the element not mutable, meaning the user can not edit the control */
|
74
72
|
readonly: boolean;
|
75
|
-
/** If defined, renders an alternative A11y text for the asterisk */
|
76
|
-
requiredLabel?: string;
|
77
73
|
/** If defined, displays provided severity state */
|
78
74
|
severity?: FormFieldSeverity;
|
79
75
|
/** If true, displays valid state after interaction */
|
@@ -1,34 +1,40 @@
|
|
1
|
+
var f = (a) => {
|
2
|
+
throw TypeError(a);
|
3
|
+
};
|
4
|
+
var b = (a, n, t) => n.has(a) || f("Cannot " + t);
|
5
|
+
var c = (a, n, t) => (b(a, n, "read from private field"), t ? t.call(a) : n.get(a)), _ = (a, n, t) => n.has(a) ? f("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), $ = (a, n, t, r) => (b(a, n, "write to private field"), r ? r.call(a, t) : n.set(a, t), t);
|
1
6
|
import "../icon/icon.js";
|
2
|
-
import { FormBase as
|
7
|
+
import { FormBase as g } from "../../internal/components/formBase.js";
|
3
8
|
import "../../internal/components/hint/hint.js";
|
4
|
-
import { hintSeverity as
|
5
|
-
import { watch as
|
6
|
-
import { Asterisk as
|
7
|
-
import { componentStyles as
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import A from "./input.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
import { hintSeverity as w } from "../../internal/helpers/hintSeverity.js";
|
10
|
+
import { watch as E } from "../../internal/helpers/watch.js";
|
11
|
+
import { Asterisk as P } from "../../internal/templates/asterisk.js";
|
12
|
+
import { componentStyles as C } from "../../styles/component.styles.js";
|
13
|
+
import { LocalizeController as k } from "../../utilities/localize.js";
|
14
|
+
import { html as p, nothing as m } from "lit";
|
15
|
+
import { state as v, property as s, query as S, queryAssignedNodes as x } from "lit/decorators.js";
|
16
|
+
import { ifDefined as l } from "lit/directives/if-defined.js";
|
17
|
+
import { live as B } from "lit/directives/live.js";
|
18
|
+
import { InputNumberController as A, InputPasswordController as V } from "./input.controllers.js";
|
19
|
+
import I from "./input.styles.js";
|
20
|
+
var L = Object.defineProperty, D = Object.getOwnPropertyDescriptor, e = (a, n, t, r) => {
|
21
|
+
for (var o = r > 1 ? void 0 : r ? D(n, t) : n, h = a.length - 1, d; h >= 0; h--)
|
22
|
+
(d = a[h]) && (o = (r ? d(n, t, o) : d(o)) || o);
|
23
|
+
return r && o && L(n, t, o), o;
|
24
|
+
}, u;
|
25
|
+
const y = class y extends g {
|
20
26
|
constructor() {
|
21
|
-
super(...arguments)
|
22
|
-
|
23
|
-
|
27
|
+
super(...arguments);
|
28
|
+
_(this, u);
|
29
|
+
$(this, u, new k(this)), this._value = "", this.debug = !1, this.hideLabel = !1, this.inputmode = "text", this.lang = "en", this.readonly = !1, this.showValid = !1, this.size = "md", this.type = "text", this.validateOn = "change", this.invalid = !1, this._buttonDown = !1, this._numberController = new A(this), this._passwordController = new V(this), this._handleInput = () => {
|
30
|
+
this._value = this.$input?.value ?? "", this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
24
31
|
}, this._resetValue = (t) => {
|
25
|
-
|
26
|
-
t.stopPropagation(), this.value = ((r = this.getAttribute("value")) == null ? void 0 : r.trim()) ?? "", this._value = this.value, this._internals.setFormValue(this.value), (a = this.$input) == null || a.focus();
|
32
|
+
t.stopPropagation(), this.value = this.getAttribute("value")?.trim() ?? "", this._value = this.value, this._internals.setFormValue(this.value), this.$input?.focus();
|
27
33
|
}, this._handlePressStart = (t) => {
|
28
34
|
this._buttonDown = !0, this.type === "number" && this._numberController.handleActionBtnLongPressStart(t);
|
29
35
|
}, this._handlePressEnd = () => {
|
30
36
|
this._buttonDown = !1, this.type === "number" && this._numberController.handleActionBtnLongPressEnd();
|
31
|
-
}, this._renderNumberButton = (t) =>
|
37
|
+
}, this._renderNumberButton = (t) => p`
|
32
38
|
<button
|
33
39
|
?disabled=${this.disabled}
|
34
40
|
@click=${(r) => {
|
@@ -43,10 +49,10 @@ const m = class m extends c {
|
|
43
49
|
>
|
44
50
|
<skf-icon name="${t === "inc" ? "chevronUp" : "chevronDown"}" size="sm"></skf-icon>
|
45
51
|
</button>
|
46
|
-
`, this._renderPasswordButton = () =>
|
52
|
+
`, this._renderPasswordButton = () => p`
|
47
53
|
<button
|
48
54
|
@click=${this._passwordController.toggleVisibility}
|
49
|
-
aria-label=${
|
55
|
+
aria-label=${this._passwordController._type === "password" ? c(this, u).term("showPassword") : c(this, u).term("hidePassword")}
|
50
56
|
class="password skf-icon-host"
|
51
57
|
type="button"
|
52
58
|
@mousedown="${this._handlePressStart}"
|
@@ -55,21 +61,20 @@ const m = class m extends c {
|
|
55
61
|
>
|
56
62
|
<skf-icon name=${this._passwordController._icon} size="sm"></skf-icon>
|
57
63
|
</button>
|
58
|
-
`, this._renderSearchButton = () =>
|
64
|
+
`, this._renderSearchButton = () => p`
|
59
65
|
<button
|
60
66
|
@click=${this._resetValue}
|
61
67
|
@mousedown=${this._handlePressStart}
|
62
68
|
@mouseup=${this._handlePressEnd}
|
63
69
|
@mouseleave=${this._handlePressEnd}
|
64
|
-
aria-label=${
|
70
|
+
aria-label=${c(this, u).term("clearEntry")}
|
65
71
|
class="search skf-icon-host"
|
66
72
|
type="button"
|
67
73
|
>
|
68
74
|
<skf-icon name="close" size="sm"></skf-icon>
|
69
75
|
</button>
|
70
76
|
`, this._onBlur = () => {
|
71
|
-
|
72
|
-
this._buttonDown && ((t = this.$input) == null || t.focus());
|
77
|
+
this._buttonDown && this.$input?.focus();
|
73
78
|
};
|
74
79
|
}
|
75
80
|
set customInvalid(t) {
|
@@ -82,16 +87,13 @@ const m = class m extends c {
|
|
82
87
|
this.$input && (this.$input.value = t, this._value = t, this._internals.setFormValue(t), this.validateInput());
|
83
88
|
}
|
84
89
|
get value() {
|
85
|
-
|
86
|
-
return ((t = this.$input) == null ? void 0 : t.value) ?? "";
|
90
|
+
return this.$input?.value ?? "";
|
87
91
|
}
|
88
92
|
firstUpdated() {
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
this.
|
93
|
-
}), this.addEventListener("invalid", (r) => {
|
94
|
-
this._pristine = !1, this.invalid = !0, this.customErrorDisplay && r.preventDefault();
|
93
|
+
this.$input?.addEventListener("change", () => {
|
94
|
+
this.validateOn === "change" && (this.validateOn = "input", this._pristine = !1), this._internals.setFormValue(this.$input?.value ?? ""), this.emitEvent("change"), this.validateInput();
|
95
|
+
}), this.addEventListener("invalid", (t) => {
|
96
|
+
this._pristine = !1, this.invalid = !0, this.customErrorDisplay && t.preventDefault();
|
95
97
|
}), this.addEventListener("reset", this._resetValue), this.validateInput();
|
96
98
|
}
|
97
99
|
willUpdate(t) {
|
@@ -106,11 +108,11 @@ const m = class m extends c {
|
|
106
108
|
valueChanged() {
|
107
109
|
this._internals.setFormValue(this.value), this.validateInput();
|
108
110
|
}
|
109
|
-
attributeChangedCallback(t, r,
|
110
|
-
if (super.attributeChangedCallback(t, r,
|
111
|
-
if (typeof
|
112
|
-
const
|
113
|
-
this._pristine = !1, this._internals.setValidity({ customError: !0 },
|
111
|
+
attributeChangedCallback(t, r, o) {
|
112
|
+
if (super.attributeChangedCallback(t, r, o), t === "value" && this._internals.setFormValue(o), t === "custom-invalid")
|
113
|
+
if (typeof o == "string") {
|
114
|
+
const d = this.withFallback(o);
|
115
|
+
this._pristine = !1, this._internals.setValidity({ customError: !0 }, d), this.invalid = !0, this.hint = d, this.checkValidity();
|
114
116
|
} else
|
115
117
|
this._internals.setValidity({}), this.validateInput();
|
116
118
|
}
|
@@ -122,78 +124,78 @@ const m = class m extends c {
|
|
122
124
|
this._internals.setValidity({ customError: this._internals.validity.customError });
|
123
125
|
else {
|
124
126
|
this.invalid = !this._pristine && !r.valid;
|
125
|
-
let
|
126
|
-
for (
|
127
|
-
const
|
128
|
-
if (r[
|
129
|
-
`Add custom message on ${this.localName} using attribute: ${
|
130
|
-
), r[
|
131
|
-
this.validationError =
|
132
|
-
const
|
127
|
+
let o;
|
128
|
+
for (o in r) {
|
129
|
+
const h = `data-${o.toString()}`;
|
130
|
+
if (r[o] && !this.hasAttribute(h) && this.debug && console.log(
|
131
|
+
`Add custom message on ${this.localName} using attribute: ${h.toUpperCase()}="Your custom message"`
|
132
|
+
), r[o]) {
|
133
|
+
this.validationError = o.toString();
|
134
|
+
const d = this.hasAttribute(h) ? this.getAttribute(h) : this.$input.validationMessage;
|
133
135
|
this._internals.setValidity(
|
134
136
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
135
|
-
this.withFallback(
|
137
|
+
this.withFallback(d)
|
136
138
|
), this.invalid && this.customErrorDisplay && this.checkValidity();
|
137
139
|
}
|
138
140
|
}
|
139
141
|
}
|
140
142
|
}
|
141
143
|
render() {
|
142
|
-
|
143
|
-
|
144
|
-
return h`
|
144
|
+
const t = (this._defaultSlot.length === 0 || !this._defaultSlot[0]?.textContent?.trim()) && !this.label;
|
145
|
+
return p`
|
145
146
|
<div id="root">
|
146
147
|
<label>
|
147
148
|
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${t} id="label">
|
148
149
|
<slot>${this.label}</slot>
|
149
|
-
${this.required ?
|
150
|
+
${this.required ? P(c(this, u).term("required")) : m}
|
150
151
|
</div>
|
151
152
|
<div id="input">
|
152
|
-
${this.type === "search" ?
|
153
|
+
${this.type === "search" ? p`<skf-icon class="skf-icon-host" name="search" size="sm"></skf-icon>` : m}
|
153
154
|
<div
|
154
|
-
data-leading=${
|
155
|
-
data-trailing=${
|
155
|
+
data-leading=${l(this.leading)}
|
156
|
+
data-trailing=${l(this.trailing)}
|
156
157
|
id="affix"
|
157
158
|
>
|
158
159
|
<input
|
159
160
|
?disabled=${this.disabled}
|
160
161
|
?readonly=${this.readonly}
|
161
162
|
?required=${this.required}
|
162
|
-
.
|
163
|
+
.autocomplete=${this.autocomplete ?? "off"}
|
164
|
+
.value=${B(this.value)}
|
163
165
|
@blur=${this._onBlur}
|
164
166
|
@input=${this._handleInput}
|
165
|
-
|
166
|
-
aria-
|
167
|
-
aria-errormessage=${o((l = this.hint) != null && l.trim() ? "hint" : u)}
|
167
|
+
aria-describedby=${l(this.hint?.trim() ? "hint" : m)}
|
168
|
+
aria-errormessage=${l(this.hint?.trim() ? "hint" : m)}
|
168
169
|
aria-invalid=${!!this.invalid}
|
169
170
|
data-testid="field-input"
|
170
|
-
inputmode=${
|
171
|
-
max=${
|
172
|
-
maxlength=${
|
173
|
-
min=${
|
174
|
-
minlength=${
|
175
|
-
name=${
|
176
|
-
pattern=${
|
177
|
-
placeholder=${
|
178
|
-
type=${
|
171
|
+
inputmode=${l(this.inputMode)}
|
172
|
+
max=${l(this.max)}
|
173
|
+
maxlength=${l(this.maxLength)}
|
174
|
+
min=${l(this.min)}
|
175
|
+
minlength=${l(this.minLength)}
|
176
|
+
name=${l(this.name)}
|
177
|
+
pattern=${l(this.pattern)}
|
178
|
+
placeholder=${l(this.placeholder)}
|
179
|
+
type=${l(
|
179
180
|
this.type === "password" ? this._passwordController._type : this.type
|
180
181
|
)}
|
181
182
|
/>
|
182
183
|
</div>
|
183
|
-
${this.type === "number" ?
|
184
|
+
${this.type === "number" ? p`
|
184
185
|
<div id="action">
|
185
186
|
${this._renderNumberButton("inc")} ${this._renderNumberButton("dec")}
|
186
187
|
</div>
|
187
|
-
` :
|
188
|
-
${this.type === "password" ? this._renderPasswordButton() :
|
189
|
-
${this.type === "search" && this._value.length > 0 ? this._renderSearchButton() :
|
188
|
+
` : m}
|
189
|
+
${this.type === "password" ? this._renderPasswordButton() : m}
|
190
|
+
${this.type === "search" && this._value.length > 0 ? this._renderSearchButton() : m}
|
190
191
|
</div>
|
191
192
|
</label>
|
192
|
-
${this.hint &&
|
193
|
+
${this.hint && p`
|
193
194
|
<skf-hint
|
195
|
+
?disabled=${this.disabled}
|
194
196
|
aria-live=${this.invalid ? "assertive" : "polite"}
|
195
197
|
id="hint"
|
196
|
-
severity=${
|
198
|
+
severity=${l(w(this.invalid, this.severity))}
|
197
199
|
>${this.customInvalid ?? this.hint}
|
198
200
|
</skf-hint>
|
199
201
|
`}
|
@@ -201,23 +203,14 @@ const m = class m extends c {
|
|
201
203
|
`;
|
202
204
|
}
|
203
205
|
};
|
204
|
-
|
205
|
-
let i =
|
206
|
+
u = new WeakMap(), y.styles = [C, I];
|
207
|
+
let i = y;
|
206
208
|
e([
|
207
|
-
|
209
|
+
v()
|
208
210
|
], i.prototype, "_value", 2);
|
209
211
|
e([
|
210
212
|
s()
|
211
213
|
], i.prototype, "autocomplete", 2);
|
212
|
-
e([
|
213
|
-
s({ attribute: "button-aria-label-clear" })
|
214
|
-
], i.prototype, "buttonAriaLabelClear", 2);
|
215
|
-
e([
|
216
|
-
s({ attribute: "button-aria-label-hide" })
|
217
|
-
], i.prototype, "buttonAriaLabelHide", 2);
|
218
|
-
e([
|
219
|
-
s({ attribute: "button-aria-label-show" })
|
220
|
-
], i.prototype, "buttonAriaLabelShow", 2);
|
221
214
|
e([
|
222
215
|
s({ attribute: "custom-invalid", reflect: !0 })
|
223
216
|
], i.prototype, "customInvalid", 1);
|
@@ -236,6 +229,9 @@ e([
|
|
236
229
|
e([
|
237
230
|
s()
|
238
231
|
], i.prototype, "label", 2);
|
232
|
+
e([
|
233
|
+
s({ type: String })
|
234
|
+
], i.prototype, "lang", 2);
|
239
235
|
e([
|
240
236
|
s()
|
241
237
|
], i.prototype, "leading", 2);
|
@@ -263,9 +259,6 @@ e([
|
|
263
259
|
e([
|
264
260
|
s({ type: Boolean })
|
265
261
|
], i.prototype, "readonly", 2);
|
266
|
-
e([
|
267
|
-
s({ attribute: "required-label" })
|
268
|
-
], i.prototype, "requiredLabel", 2);
|
269
262
|
e([
|
270
263
|
s({ reflect: !0 })
|
271
264
|
], i.prototype, "severity", 2);
|
@@ -288,19 +281,19 @@ e([
|
|
288
281
|
s({})
|
289
282
|
], i.prototype, "value", 1);
|
290
283
|
e([
|
291
|
-
|
284
|
+
v()
|
292
285
|
], i.prototype, "invalid", 2);
|
293
286
|
e([
|
294
|
-
|
287
|
+
v()
|
295
288
|
], i.prototype, "_buttonDown", 2);
|
296
289
|
e([
|
297
|
-
|
290
|
+
S("input")
|
298
291
|
], i.prototype, "$input", 2);
|
299
292
|
e([
|
300
|
-
|
293
|
+
x({ flatten: !0 })
|
301
294
|
], i.prototype, "_defaultSlot", 2);
|
302
295
|
e([
|
303
|
-
|
296
|
+
E("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
304
297
|
], i.prototype, "valueChanged", 1);
|
305
298
|
export {
|
306
299
|
i as SkfInput
|
@@ -38,7 +38,6 @@ export declare class InputPasswordController implements ReactiveController {
|
|
38
38
|
host?: ReactiveControllerHost & Partial<ControllerHostProps>;
|
39
39
|
_inputElement?: HTMLInputElement;
|
40
40
|
_icon: Extract<Icon, 'visibility' | 'visibilityOff'>;
|
41
|
-
_buttonAriaLabel: string;
|
42
41
|
_type: Extract<SkfInput['type'], 'password' | 'text'>;
|
43
42
|
constructor(host: ReactiveControllerHost);
|
44
43
|
hostUpdated(): void;
|