@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/components/accordion/accordion-item.component.js +49 -38
- package/dist/components/accordion/accordion.component.d.ts +1 -1
- package/dist/components/accordion/accordion.component.js +10 -10
- package/dist/components/breadcrumb/breadcrumb-item.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/components/card/card.component.js +3 -3
- package/dist/components/card/card.styles.js +29 -13
- package/dist/components/{date-picker/datepicker.calendar.component.d.ts → datepicker/datepicker-calendar.component.d.ts} +4 -1
- package/dist/components/{date-picker/datepicker.calendar.component.js → datepicker/datepicker-calendar.component.js} +7 -7
- 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} +5 -20
- package/dist/components/{date-picker/datepicker.component.js → datepicker/datepicker-popup.component.js} +12 -12
- 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} +17 -12
- package/dist/components/{date-picker-input/datepicker-input.component.js → datepicker/datepicker.component.js} +110 -97
- package/dist/components/datepicker/datepicker.d.ts +8 -0
- package/dist/components/datepicker/datepicker.js +6 -0
- package/dist/components/dialog/dialog.component.js +1 -1
- package/dist/components/dialog/dialog.d.ts +2 -2
- package/dist/components/drawer/drawer.d.ts +2 -2
- package/dist/components/header/header.d.ts +2 -2
- package/dist/components/heading/heading.component.js +36 -22
- package/dist/components/input/input.component.js +26 -26
- package/dist/components/menu/menu-item.d.ts +2 -2
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/nav/nav-item.component.d.ts +2 -2
- package/dist/components/nav/nav.d.ts +2 -2
- package/dist/components/popover/popover.component.js +1 -1
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/progress/progress.d.ts +2 -2
- package/dist/components/progress/progress.styles.js +8 -6
- package/dist/components/segmented-button/segmented-button-item.d.ts +2 -2
- package/dist/components/segmented-button/segmented-button.d.ts +2 -2
- package/dist/components/select/select-option-group.d.ts +2 -2
- package/dist/components/select/select-option.component.d.ts +2 -2
- package/dist/components/select/select-option.component.js +1 -1
- package/dist/components/select/select.component.d.ts +2 -2
- package/dist/components/select/select.component.js +2 -2
- package/dist/components/select/select.controllers.js +11 -14
- package/dist/components/stepper/stepper-item.component.js +47 -47
- package/dist/components/stepper/stepper-item.d.ts +2 -2
- package/dist/components/stepper/stepper.d.ts +2 -2
- package/dist/components/switch/switch.d.ts +2 -2
- package/dist/components/{tab-panel → tabs}/tab-panel.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.component.d.ts +2 -2
- package/dist/components/{tab → tabs}/tab.d.ts +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 +1 -1
- package/dist/components/tag/tag.component.js +23 -40
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.styles.js +63 -50
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/custom-elements.json +60 -93
- package/dist/index.d.ts +6 -5
- package/dist/index.js +96 -93
- package/dist/internal/base-classes/popover/popover.base.js +1 -1
- package/dist/internal/components/skf-element.d.ts +1 -3
- package/dist/internal/components/skf-element.js +4 -9
- package/dist/styles/global-alt.css +1 -0
- package/dist/styles/global.css +1 -1
- package/dist/types/jsx/custom-element-jsx.d.ts +78 -39
- package/dist/types/vue/index.d.ts +78 -39
- package/dist/vscode.html-custom-data.json +97 -11
- package/dist/web-types.json +196 -45
- package/package.json +9 -15
- 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.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.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/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.component.d.ts +0 -0
- /package/dist/components/{tab-panel → tabs}/tab-panel.component.js +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.component.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 → tabs}/tab.styles.js +0 -0
- /package/dist/components/{tab-group/tab-group.styles.d.ts → tabs/tabs.styles.d.ts} +0 -0
@@ -4,9 +4,12 @@ import '../../internal/components/hint/hint.js';
|
|
4
4
|
import { PopoverController } from '../../internal/controllers/popover.controller.js';
|
5
5
|
import type { FormFieldBaseProps } from '../../internal/types/formField.js';
|
6
6
|
import { type CSSResultGroup } from 'lit';
|
7
|
-
import '
|
8
|
-
import
|
9
|
-
|
7
|
+
import type { SkfDatepickerPopup, SkfDatepickerPopupDateRange } from './datepicker-popup.component.js';
|
8
|
+
import './datepicker-popup.js';
|
9
|
+
/**
|
10
|
+
* @tagname skf-datepicker
|
11
|
+
*/
|
12
|
+
export declare class SkfDatepicker extends FormBase {
|
10
13
|
/** @internal */
|
11
14
|
static styles: CSSResultGroup;
|
12
15
|
/** @inernal */
|
@@ -61,7 +64,7 @@ export declare class SkfDatePickerInput extends FormBase {
|
|
61
64
|
/** true if the internal state is invalid */
|
62
65
|
invalid: boolean;
|
63
66
|
/** @internal */
|
64
|
-
selectedRangeDates:
|
67
|
+
selectedRangeDates: SkfDatepickerPopupDateRange;
|
65
68
|
/** @internal */
|
66
69
|
private showClearbutton;
|
67
70
|
/** @internal */
|
@@ -73,35 +76,37 @@ export declare class SkfDatePickerInput extends FormBase {
|
|
73
76
|
/** @internal */
|
74
77
|
$input_range_end: HTMLInputElement;
|
75
78
|
/** @internal */
|
76
|
-
$
|
79
|
+
$datepickerPopup: SkfDatepickerPopup;
|
77
80
|
/** @internal */
|
78
81
|
_defaultSlot: Node[];
|
79
|
-
|
80
|
-
|
82
|
+
/** @internal */
|
83
|
+
private abortController;
|
84
|
+
/** @internal */
|
85
|
+
private abortSignal;
|
81
86
|
constructor();
|
82
87
|
connectedCallback(): void;
|
83
88
|
disconnectedCallback(): void;
|
84
|
-
_handleSelectedDate
|
89
|
+
private _handleSelectedDate;
|
85
90
|
protected firstUpdated(): void;
|
86
91
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
92
|
+
_handleValueChange(): void;
|
87
93
|
private _handleDateSelected;
|
88
94
|
/** @internal */
|
89
95
|
_handleKeyboardEvents: (e: KeyboardEvent) => void;
|
90
96
|
/** @internal */
|
91
97
|
private _handleFocus;
|
92
|
-
showPopover
|
93
|
-
hidePopover
|
98
|
+
showPopover(): void;
|
99
|
+
hidePopover(): void;
|
94
100
|
/** @internal */
|
95
101
|
_handleBlur: (event: FocusEvent) => void;
|
96
102
|
/** @internal */
|
97
103
|
private _handleClose;
|
98
104
|
/** @internal */
|
99
105
|
private clearInput;
|
100
|
-
_handleValueChange(): void;
|
101
106
|
/**
|
102
107
|
* Clears the input field
|
103
108
|
*/
|
104
|
-
clear
|
109
|
+
clear(): void;
|
105
110
|
/** @internal although called on input its only triggered once value is valid date */
|
106
111
|
_handleInput: (event: Event) => void;
|
107
112
|
/** @internal */
|
@@ -1,28 +1,28 @@
|
|
1
|
-
import { dateFormatter as v, is as f, isPopoverOpen as S, debounce as E } from "./datepicker-input.helpers.js";
|
2
1
|
import "../icon/icon.js";
|
3
|
-
import { computePosition as
|
4
|
-
import { FormBase as
|
2
|
+
import { computePosition as P, flip as S, offset as E } from "@floating-ui/dom";
|
3
|
+
import { FormBase as C } from "../../internal/components/formBase.js";
|
5
4
|
import "../../internal/components/hint/hint.js";
|
6
|
-
import { PopoverController as
|
7
|
-
import { hintSeverity as
|
8
|
-
import { watch as
|
9
|
-
import { Asterisk as
|
5
|
+
import { PopoverController as I } from "../../internal/controllers/popover.controller.js";
|
6
|
+
import { hintSeverity as O } from "../../internal/helpers/hintSeverity.js";
|
7
|
+
import { watch as M } from "../../internal/helpers/watch.js";
|
8
|
+
import { Asterisk as T } from "../../internal/templates/asterisk.js";
|
10
9
|
import { Temporal as w } from "@js-temporal/polyfill";
|
11
|
-
import { componentStyles as
|
10
|
+
import { componentStyles as B } from "../../styles/component.styles.js";
|
12
11
|
import { nothing as g, html as y } from "lit";
|
13
|
-
import { property as h, state as $, query as b, queryAssignedNodes as
|
14
|
-
import { ifDefined as
|
12
|
+
import { property as h, state as $, query as b, queryAssignedNodes as x } from "lit/decorators.js";
|
13
|
+
import { ifDefined as u } from "lit/directives/if-defined.js";
|
15
14
|
import { live as F } from "lit/directives/live.js";
|
16
|
-
import "
|
17
|
-
import {
|
15
|
+
import "./datepicker-popup.js";
|
16
|
+
import { dateFormatter as v, is as f, isPopoverOpen as L, debounce as R } from "./datepicker.helpers.js";
|
17
|
+
import { styles as A } from "./datepicker.styles.js";
|
18
18
|
var j = Object.defineProperty, q = Object.getOwnPropertyDescriptor, r = (D, e, t, a) => {
|
19
|
-
for (var
|
20
|
-
(d = D[n]) && (
|
21
|
-
return a &&
|
19
|
+
for (var o = a > 1 ? void 0 : a ? q(e, t) : e, n = D.length - 1, d; n >= 0; n--)
|
20
|
+
(d = D[n]) && (o = (a ? d(e, t, o) : d(o)) || o);
|
21
|
+
return a && o && j(e, t, o), o;
|
22
22
|
};
|
23
|
-
const _ = class _ extends
|
23
|
+
const _ = class _ extends C {
|
24
24
|
constructor() {
|
25
|
-
super(), this.popoverController = new
|
25
|
+
super(), this.popoverController = new I(this), this.id = "skf-datepicker-input", this.placeholder = "YYYY-MM-DD", this.range = !1, this.size = "md", this.validateOn = "change", this.invalid = !1, this.selectedRangeDates = { start: null, end: null }, this.showClearbutton = !1, this.abortController = new AbortController(), this.abortSignal = this.abortController.signal, this._handleSelectedDate = () => {
|
26
26
|
this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
|
27
27
|
}, this._handleDateSelected = (e) => {
|
28
28
|
if (this.range && "start" in e.detail.date && "end" in e.detail.date) {
|
@@ -32,31 +32,31 @@ const _ = class _ extends M {
|
|
32
32
|
this.$popover.hidePopover();
|
33
33
|
}));
|
34
34
|
}, this._handleKeyboardEvents = (e) => {
|
35
|
-
var a,
|
35
|
+
var a, o;
|
36
36
|
const t = e.target.closest("input");
|
37
37
|
if (t) {
|
38
38
|
if ((t.selectionStart ?? 0) < t.value.length && /[[0-9-]/.test(e.key)) {
|
39
|
-
const n = t.selectionStart ?? 0,
|
40
|
-
t.value =
|
39
|
+
const n = t.selectionStart ?? 0, p = t.value.split("").slice(0, n);
|
40
|
+
t.value = p.join("");
|
41
41
|
}
|
42
42
|
if (t.name.endsWith("-end") && (e.key === "Backspace" && t.value.length === 0 || t.selectionStart === 0 && e.key === "ArrowLeft") && (e.preventDefault(), this.$input.focus()), e.key === "Tab" && !e.shiftKey && t.name.endsWith("-end")) {
|
43
43
|
e.preventDefault();
|
44
|
-
const d = (a = this.$popover.childNodes[1].shadowRoot) == null ? void 0 : a.querySelector("skf-datepicker-calendar"),
|
45
|
-
|
44
|
+
const d = (a = this.$popover.childNodes[1].shadowRoot) == null ? void 0 : a.querySelector("skf-datepicker-calendar"), p = (o = d == null ? void 0 : d.shadowRoot) == null ? void 0 : o.querySelector("button");
|
45
|
+
p == null || p.focus();
|
46
46
|
}
|
47
47
|
if ((t.value.length === 4 || t.value.length === 7) && /[[0-9]/.test(e.key) && (t.value = `${t.value}-${e.key}`, e.preventDefault()), e.key === "Escape")
|
48
48
|
if (t.blur(), this.$popover.hidePopover(), this.range) {
|
49
49
|
const n = this.$input.value, d = this.$input_range_end.value;
|
50
50
|
if (!f(n, d).date()) return;
|
51
|
-
this.$
|
51
|
+
this.$datepickerPopup.selectedDateRange = {
|
52
52
|
start: new Date(n),
|
53
53
|
end: new Date(d)
|
54
|
-
}, this.$
|
54
|
+
}, this.$datepickerPopup.emit("selected-date-changed", {
|
55
55
|
detail: { date: new Date(n) }
|
56
56
|
});
|
57
57
|
} else {
|
58
58
|
if (!t.value || !f(t.value).date()) return;
|
59
|
-
this.$
|
59
|
+
this.$datepickerPopup.emit("selected-date-changed", {
|
60
60
|
detail: { date: new Date(t.value) }
|
61
61
|
});
|
62
62
|
}
|
@@ -64,36 +64,26 @@ const _ = class _ extends M {
|
|
64
64
|
}
|
65
65
|
}, this._handleFocus = () => {
|
66
66
|
this.showPopover();
|
67
|
-
}, this.showPopover = () => {
|
68
|
-
if (S(this.$popover)) return;
|
69
|
-
E(() => {
|
70
|
-
this.$popover.showPopover(), this._animatePopover({ show: !0 });
|
71
|
-
}, 200)(), this.addEventListener("focusout", this.hidePopover, { once: !0, signal: this.abortSignal });
|
72
|
-
}, this.hidePopover = () => {
|
73
|
-
var t;
|
74
|
-
this.removeEventListener("focusout", this.hidePopover), ((t = document.activeElement) == null ? void 0 : t.closest("skf-datepicker-input")) !== this && this.$popover.hidePopover();
|
75
67
|
}, this._handleBlur = (e) => {
|
76
68
|
!e.target.name.endsWith("-end") && this.range;
|
77
69
|
}, this._handleClose = () => {
|
78
70
|
this.$anchor.blur();
|
79
71
|
}, this.clearInput = () => {
|
80
|
-
this.value = "", this.$
|
81
|
-
}, this.clear = () => {
|
82
|
-
this.clearInput(), this._toggleClearButton(!1);
|
72
|
+
this.value = "", this.$datepickerPopup.clearSelection();
|
83
73
|
}, this._handleInput = (e) => {
|
84
74
|
const t = e.target, a = String(t.value).replace(/[^0-9-]/g, "");
|
85
75
|
if (t.value = a, t.setCustomValidity(this.customError ?? ""), !!f(t.value).ISO()) {
|
86
|
-
if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$
|
87
|
-
this.$
|
76
|
+
if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$datepickerPopup.date = t.value, this.range) {
|
77
|
+
this.$datepickerPopup.selectedDateRange = {
|
88
78
|
start: f(this.$input.value).ISO() ? new Date(this.$input.value) : null,
|
89
79
|
end: f(this.$input_range_end.value).ISO() ? new Date(this.$input_range_end.value) : null
|
90
80
|
};
|
91
|
-
const
|
92
|
-
this.value =
|
81
|
+
const o = Object.values(this.$datepickerPopup.selectedDateRange).filter(Boolean).map((n) => new Date(n).toLocaleDateString("en-CA")).join();
|
82
|
+
this.value = o, f(this.$input.value).ISO() && (this.focusTimeoutId = setTimeout(() => {
|
93
83
|
this.$input_range_end.focus();
|
94
84
|
}, 200));
|
95
85
|
} else
|
96
|
-
this.$
|
86
|
+
this.$datepickerPopup.selectedDate = new Date(t.value), this.$datepickerPopup.emit("selected-date-changed", {
|
97
87
|
detail: { date: new Date(t.value) }
|
98
88
|
});
|
99
89
|
this.validateOn === "input" && (this._pristine = !1, this.validateInput());
|
@@ -101,9 +91,9 @@ const _ = class _ extends M {
|
|
101
91
|
}, this._toggleClearButton = (e = !1) => {
|
102
92
|
this.showClearbutton = e;
|
103
93
|
}, this.reposition = async () => {
|
104
|
-
const { x: e, y: t } = await
|
94
|
+
const { x: e, y: t } = await P(this.$anchor, this.$popover, {
|
105
95
|
placement: "bottom-start",
|
106
|
-
middleware: [
|
96
|
+
middleware: [S(), E(0)],
|
107
97
|
strategy: "fixed"
|
108
98
|
});
|
109
99
|
Object.assign(this.$popover.style, {
|
@@ -129,10 +119,10 @@ const _ = class _ extends M {
|
|
129
119
|
}
|
130
120
|
firstUpdated() {
|
131
121
|
var e;
|
132
|
-
this.$
|
122
|
+
this.$datepickerPopup.date = this._init_date ? w.PlainDate.from(this._init_date).toString() : w.Now.plainDateISO().toString(), this.range ? this.$datepickerPopup.selectedDateRange = {
|
133
123
|
start: this._init_date ? new Date(this._init_date) : null,
|
134
124
|
end: (e = this.value) != null && e.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
135
|
-
} : this.$
|
125
|
+
} : this.$datepickerPopup.selectedDate = this._init_date ? new Date(this._init_date) : void 0, this.hint && !this.hasAttribute("hint") && this.setAttribute("hint", this.hint), this.validateInput();
|
136
126
|
}
|
137
127
|
attributeChangedCallback(e, t, a) {
|
138
128
|
if (super.attributeChangedCallback(e, t, a), e === "custom-invalid")
|
@@ -143,19 +133,38 @@ const _ = class _ extends M {
|
|
143
133
|
this._internals.setValidity({}), this.validateInput();
|
144
134
|
}
|
145
135
|
_handleValueChange() {
|
146
|
-
var e, t, a,
|
147
|
-
(e = this.value) != null && e.trim() || this.$
|
136
|
+
var e, t, a, o, n, d, p, i;
|
137
|
+
(e = this.value) != null && e.trim() || this.$datepickerPopup.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = v((t = this.value) == null ? void 0 : t.split(",")[0]), this.range ? (this.$datepickerPopup.selectedDateRange = {
|
148
138
|
start: (n = this.value) != null && n.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
|
149
139
|
end: (d = this.value) != null && d.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
150
|
-
}, this.$input_range_end.value = v((
|
140
|
+
}, this.$input_range_end.value = v((p = this.value) == null ? void 0 : p.split(",")[1]), this.$datepickerPopup.date = ((i = this.value) == null ? void 0 : i.split(",")[0]) ?? "") : (this.$datepickerPopup.selectedDate = (a = this.value) != null && a.split(",")[0] ? new Date(this.value.split(",")[0]) : void 0, this.$datepickerPopup.date = ((o = this.value) == null ? void 0 : o.split(",")[0]) ?? ""), this.validateInput();
|
141
|
+
}
|
142
|
+
showPopover() {
|
143
|
+
if (L(this.$popover)) return;
|
144
|
+
R(() => {
|
145
|
+
this.$popover.showPopover(), this._animatePopover({ show: !0 });
|
146
|
+
}, 200)(), this.addEventListener("focusout", this.hidePopover.bind(this), {
|
147
|
+
once: !0,
|
148
|
+
signal: this.abortSignal
|
149
|
+
});
|
150
|
+
}
|
151
|
+
hidePopover() {
|
152
|
+
var t;
|
153
|
+
this.removeEventListener("focusout", this.hidePopover.bind(this)), ((t = document.activeElement) == null ? void 0 : t.closest("skf-datepicker-input")) !== this && this.$popover.hidePopover();
|
154
|
+
}
|
155
|
+
/**
|
156
|
+
* Clears the input field
|
157
|
+
*/
|
158
|
+
clear() {
|
159
|
+
this.clearInput(), this._toggleClearButton(!1);
|
151
160
|
}
|
152
161
|
/** @internal */
|
153
162
|
async _animatePopover({ el: e = this.$popover, show: t }) {
|
154
163
|
return t && (e.style.opacity = "0", e.style.transform = "scaleY(0.5)"), new Promise((a) => {
|
155
|
-
const
|
164
|
+
const o = [
|
156
165
|
{ opacity: 0, transform: "scaleY(0.5)" },
|
157
166
|
{ opacity: 1, transform: "scaleY(1)" }
|
158
|
-
], n = t ?
|
167
|
+
], n = t ? o : o.reverse();
|
159
168
|
setTimeout(
|
160
169
|
() => {
|
161
170
|
e.style.transformOrigin = "top";
|
@@ -177,20 +186,20 @@ const _ = class _ extends M {
|
|
177
186
|
if (this._internals.validity.customError) return;
|
178
187
|
let t = JSON.parse(JSON.stringify(this._internals.validity)), a = {};
|
179
188
|
if (this.selectableFrom) {
|
180
|
-
const { validityFragment: i, errorMessageFragment:
|
181
|
-
t = { ...t, ...i }, a = { ...a, ...
|
189
|
+
const { validityFragment: i, errorMessageFragment: l } = o(this);
|
190
|
+
t = { ...t, ...i }, a = { ...a, ...l };
|
182
191
|
}
|
183
192
|
if (this.selectableTo) {
|
184
|
-
const { validityFragment: i, errorMessageFragment:
|
185
|
-
t = { ...t, ...i }, a = { ...a, ...
|
193
|
+
const { validityFragment: i, errorMessageFragment: l } = n(this);
|
194
|
+
t = { ...t, ...i }, a = { ...a, ...l };
|
186
195
|
}
|
187
196
|
if (this.range) {
|
188
|
-
const { validityFragment: i, errorMessageFragment:
|
189
|
-
t = { ...t, ...i }, a = { ...a, ...
|
197
|
+
const { validityFragment: i, errorMessageFragment: l } = d(this);
|
198
|
+
t = { ...t, ...i }, a = { ...a, ...l };
|
190
199
|
}
|
191
200
|
if (this.required) {
|
192
|
-
const { validityFragment: i, errorMessageFragment:
|
193
|
-
t = { ...t, ...i }, a = { ...a, ...
|
201
|
+
const { validityFragment: i, errorMessageFragment: l } = p(this);
|
202
|
+
t = { ...t, ...i }, a = { ...a, ...l };
|
194
203
|
}
|
195
204
|
if (t.valid = !Object.values(t).some((i) => i), this.invalid = !1, t.valid)
|
196
205
|
this._internals.setValidity({ customError: this._internals.validity.customError }), this.hint = this.getAttribute("hint") ?? "";
|
@@ -198,10 +207,10 @@ const _ = class _ extends M {
|
|
198
207
|
this.invalid = !this._pristine && !t.valid;
|
199
208
|
let i;
|
200
209
|
for (i in t) {
|
201
|
-
const
|
210
|
+
const l = `data-${i.toString()}`;
|
202
211
|
if (t[i]) {
|
203
212
|
this.validationError = i.toString();
|
204
|
-
const c = this.hasAttribute(
|
213
|
+
const c = this.hasAttribute(l) ? this.getAttribute(l) : a[i];
|
205
214
|
this._internals.setValidity(
|
206
215
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
207
216
|
this.withFallback(c)
|
@@ -209,9 +218,9 @@ const _ = class _ extends M {
|
|
209
218
|
}
|
210
219
|
}
|
211
220
|
}
|
212
|
-
function
|
213
|
-
const
|
214
|
-
if (!i.selectableFrom) return
|
221
|
+
function o(i) {
|
222
|
+
const l = { validityFragment: {}, errorMessageFragment: {} };
|
223
|
+
if (!i.selectableFrom) return l;
|
215
224
|
const c = new Date(i.selectableFrom);
|
216
225
|
if (new Date(i.$input.value) < c) {
|
217
226
|
const m = i.getAttribute("data-rangeunderflow") ?? `Date is out of range. Earliest selectable date is ${i.selectableFrom}.`;
|
@@ -220,11 +229,11 @@ const _ = class _ extends M {
|
|
220
229
|
errorMessageFragment: { rangeUnderflow: m }
|
221
230
|
};
|
222
231
|
}
|
223
|
-
return
|
232
|
+
return l;
|
224
233
|
}
|
225
234
|
function n(i) {
|
226
|
-
const
|
227
|
-
if (!i.selectableTo) return
|
235
|
+
const l = { validityFragment: {}, errorMessageFragment: {} };
|
236
|
+
if (!i.selectableTo) return l;
|
228
237
|
const c = new Date(i.selectableTo);
|
229
238
|
if (new Date(i.$input.value) > c) {
|
230
239
|
const m = i.getAttribute("data-rangeoverflow") ?? `Date is out of range. Latest selectable date is ${i.selectableTo}.`;
|
@@ -233,10 +242,10 @@ const _ = class _ extends M {
|
|
233
242
|
errorMessageFragment: { rangeOverflow: m }
|
234
243
|
};
|
235
244
|
}
|
236
|
-
return
|
245
|
+
return l;
|
237
246
|
}
|
238
247
|
function d(i) {
|
239
|
-
const
|
248
|
+
const l = { validityFragment: {}, errorMessageFragment: {} }, c = new Date(i.$input.value);
|
240
249
|
if (new Date(i.$input_range_end.value) < c) {
|
241
250
|
const m = i.getAttribute("data-rangeunderflow") ?? "End date cannot be before start date";
|
242
251
|
return {
|
@@ -244,18 +253,18 @@ const _ = class _ extends M {
|
|
244
253
|
errorMessageFragment: { rangeUnderflow: m }
|
245
254
|
};
|
246
255
|
}
|
247
|
-
return
|
256
|
+
return l;
|
248
257
|
}
|
249
|
-
function
|
250
|
-
const
|
258
|
+
function p(i) {
|
259
|
+
const l = { validityFragment: {}, errorMessageFragment: {} };
|
251
260
|
return !i.$input.value || i.range && !i.$input_range_end.value ? {
|
252
261
|
validityFragment: { valueMissing: !0, valid: !1 },
|
253
262
|
errorMessageFragment: { valueMissing: "This field is required" }
|
254
|
-
} :
|
263
|
+
} : l;
|
255
264
|
}
|
256
265
|
}
|
257
266
|
render() {
|
258
|
-
var t, a,
|
267
|
+
var t, a, o, n, d, p, i, l;
|
259
268
|
const e = (this._defaultSlot.length === 0 || !((a = (t = this._defaultSlot[0]) == null ? void 0 : t.textContent) != null && a.trim())) && !this.label;
|
260
269
|
return y`
|
261
270
|
<div
|
@@ -270,29 +279,29 @@ const _ = class _ extends M {
|
|
270
279
|
<label>
|
271
280
|
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${e} id="label">
|
272
281
|
<slot>${this.label}</slot>
|
273
|
-
${this.required ?
|
282
|
+
${this.required ? T(this.requiredLabel) : null}
|
274
283
|
</div>
|
275
284
|
<div id="input">
|
276
285
|
<input
|
277
286
|
?disabled=${this.disabled}
|
278
287
|
?readonly=${this.readonly}
|
279
288
|
.value=${F(
|
280
|
-
this.range ? v((
|
289
|
+
this.range ? v((o = this.value) == null ? void 0 : o.split(",")[0]) : v(this.value)
|
281
290
|
)}
|
282
291
|
@blur=${this._handleBlur}
|
283
292
|
@click=${this._handleFocus}
|
284
293
|
@focus=${this._handleFocus}
|
285
294
|
@input=${this._handleInput}
|
286
295
|
@keydown=${this._handleKeyboardEvents}
|
287
|
-
aria-describedby=${
|
288
|
-
aria-errormessage=${
|
296
|
+
aria-describedby=${u((n = this.hint) != null && n.trim() ? "hint" : g)}
|
297
|
+
aria-errormessage=${u((d = this.hint) != null && d.trim() ? "hint" : g)}
|
289
298
|
aria-invalid=${!!this.invalid}
|
290
299
|
autocomplete="off"
|
291
300
|
data-testid="field-input"
|
292
|
-
inputmode=${
|
301
|
+
inputmode=${u(this.inputMode)}
|
293
302
|
maxlength="10"
|
294
303
|
name=${this.name ?? "calendar"}
|
295
|
-
placeholder=${
|
304
|
+
placeholder=${u(this.placeholder)}
|
296
305
|
type="text"
|
297
306
|
/>
|
298
307
|
${this.range ? y`
|
@@ -300,26 +309,30 @@ const _ = class _ extends M {
|
|
300
309
|
<input
|
301
310
|
?disabled=${this.disabled}
|
302
311
|
?readonly=${this.readonly}
|
303
|
-
.value=${F(v((
|
312
|
+
.value=${F(v((p = this.value) == null ? void 0 : p.split(",")[1]))}
|
304
313
|
@blur=${this._handleBlur}
|
305
314
|
@click=${this._handleFocus}
|
306
315
|
@focus=${this._handleFocus}
|
307
316
|
@input=${this._handleInput}
|
308
317
|
@keydown=${this._handleKeyboardEvents}
|
309
|
-
aria-describedby=${
|
310
|
-
aria-errormessage=${
|
318
|
+
aria-describedby=${u((i = this.hint) != null && i.trim() ? "hint" : g)}
|
319
|
+
aria-errormessage=${u((l = this.hint) != null && l.trim() ? "hint" : g)}
|
311
320
|
aria-invalid=${!!this.invalid}
|
312
321
|
autocomplete="off"
|
313
322
|
data-testid="field-input-range-end"
|
314
|
-
inputmode=${
|
323
|
+
inputmode=${u(this.inputMode)}
|
315
324
|
maxlength="10"
|
316
325
|
name=${(this.name ?? "calendar") + "-end"}
|
317
|
-
placeholder=${
|
326
|
+
placeholder=${u(this.placeholder)}
|
318
327
|
type="text"
|
319
328
|
/>
|
320
329
|
` : g}
|
321
330
|
${this.showClearbutton ? y`
|
322
|
-
<button
|
331
|
+
<button
|
332
|
+
class="password skf-icon-host"
|
333
|
+
type="button"
|
334
|
+
@click=${this.clear.bind(this)}
|
335
|
+
>
|
323
336
|
<skf-icon name="close" size="sm"></skf-icon>
|
324
337
|
</button>
|
325
338
|
` : y`
|
@@ -333,25 +346,25 @@ const _ = class _ extends M {
|
|
333
346
|
<skf-hint
|
334
347
|
aria-live=${this.invalid ? "assertive" : "polite"}
|
335
348
|
id="hint"
|
336
|
-
severity=${
|
349
|
+
severity=${u(O(this.invalid, this.severity))}
|
337
350
|
>${this.customInvalid ?? this.hint}
|
338
351
|
</skf-hint>
|
339
352
|
`}
|
340
353
|
</div>
|
341
354
|
|
342
355
|
<div id="popover" popover @close=${this._handleClose}>
|
343
|
-
<skf-datepicker
|
356
|
+
<skf-datepicker-popup
|
344
357
|
?range=${this.range}
|
345
358
|
id=${this.id}
|
346
|
-
invalid-dates=${
|
347
|
-
selectable-from=${
|
348
|
-
selectable-to=${
|
349
|
-
></skf-datepicker>
|
359
|
+
invalid-dates=${u(this.invalidDates)}
|
360
|
+
selectable-from=${u(this.selectableFrom)}
|
361
|
+
selectable-to=${u(this.selectableTo)}
|
362
|
+
></skf-datepicker-popup>
|
350
363
|
</div>
|
351
364
|
`;
|
352
365
|
}
|
353
366
|
};
|
354
|
-
_.styles = [
|
367
|
+
_.styles = [B, A];
|
355
368
|
let s = _;
|
356
369
|
r([
|
357
370
|
h({ attribute: "custom-invalid", reflect: !0 })
|
@@ -429,14 +442,14 @@ r([
|
|
429
442
|
b('input[data-testid="field-input-range-end"]')
|
430
443
|
], s.prototype, "$input_range_end", 2);
|
431
444
|
r([
|
432
|
-
b("skf-datepicker")
|
433
|
-
], s.prototype, "$
|
445
|
+
b("skf-datepicker-popup")
|
446
|
+
], s.prototype, "$datepickerPopup", 2);
|
434
447
|
r([
|
435
|
-
|
448
|
+
x({ flatten: !0 })
|
436
449
|
], s.prototype, "_defaultSlot", 2);
|
437
450
|
r([
|
438
|
-
|
451
|
+
M("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
439
452
|
], s.prototype, "_handleValueChange", 1);
|
440
453
|
export {
|
441
|
-
s as
|
454
|
+
s as SkfDatepicker
|
442
455
|
};
|
@@ -103,7 +103,7 @@ const y = class y extends C {
|
|
103
103
|
/** Method that opens the dialog in modal state */
|
104
104
|
async showModal() {
|
105
105
|
async function t(o) {
|
106
|
-
return o.$dialog ? (o.$dialog.showModal(), await o._transition().entry(), o.emit("skf-dialog-opened"), !0) : !1;
|
106
|
+
return o.$dialog ? (o.open = !0, o.$dialog.showModal(), await o._transition().entry(), o.emit("skf-dialog-opened"), !0) : !1;
|
107
107
|
}
|
108
108
|
return await t(this);
|
109
109
|
}
|
@@ -1,35 +1,49 @@
|
|
1
1
|
import { SkfElement as f } from "../../internal/components/skf-element.js";
|
2
|
-
import { componentStyles as
|
2
|
+
import { componentStyles as c } from "../../styles/component.styles.js";
|
3
3
|
import "lit";
|
4
|
-
import { property as
|
5
|
-
import { literal as
|
6
|
-
import { styles as
|
7
|
-
var
|
8
|
-
for (var
|
9
|
-
(
|
10
|
-
return
|
4
|
+
import { property as h } from "lit/decorators.js";
|
5
|
+
import { literal as e, html as u } from "lit/static-html.js";
|
6
|
+
import { styles as n } from "./heading.styles.js";
|
7
|
+
var y = Object.defineProperty, m = (l, t, i, d) => {
|
8
|
+
for (var r = void 0, o = l.length - 1, p; o >= 0; o--)
|
9
|
+
(p = l[o]) && (r = p(t, i, r) || r);
|
10
|
+
return r && y(t, i, r), r;
|
11
11
|
};
|
12
|
-
const
|
12
|
+
const a = class a extends f {
|
13
13
|
constructor() {
|
14
14
|
super(...arguments), this.as = "h2";
|
15
15
|
}
|
16
16
|
render() {
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
let t;
|
18
|
+
switch (!0) {
|
19
|
+
case this.as === "h1":
|
20
|
+
t = e`h1`;
|
21
|
+
break;
|
22
|
+
case this.as === "h3":
|
23
|
+
t = e`h3`;
|
24
|
+
break;
|
25
|
+
case this.as === "h4":
|
26
|
+
t = e`h4`;
|
27
|
+
break;
|
28
|
+
default:
|
29
|
+
t = e`h2`;
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
return u`
|
33
|
+
<${t} id="root">
|
20
34
|
<slot></slot>
|
21
|
-
</${
|
35
|
+
</${t}>
|
22
36
|
`;
|
23
37
|
}
|
24
38
|
};
|
25
|
-
|
26
|
-
let
|
27
|
-
|
28
|
-
|
29
|
-
],
|
30
|
-
|
31
|
-
|
32
|
-
],
|
39
|
+
a.styles = [c, n];
|
40
|
+
let s = a;
|
41
|
+
m([
|
42
|
+
h({ reflect: !0 })
|
43
|
+
], s.prototype, "as");
|
44
|
+
m([
|
45
|
+
h({ attribute: "styled-as", reflect: !0 })
|
46
|
+
], s.prototype, "styledAs");
|
33
47
|
export {
|
34
|
-
|
48
|
+
s as SkfHeading
|
35
49
|
};
|