@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
@@ -1,61 +1,69 @@
|
|
1
|
+
var P = (d) => {
|
2
|
+
throw TypeError(d);
|
3
|
+
};
|
4
|
+
var E = (d, h, e) => h.has(d) || P("Cannot " + e);
|
5
|
+
var k = (d, h, e) => (E(d, h, "read from private field"), e ? e.call(d) : h.get(d)), C = (d, h, e) => h.has(d) ? P("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(d) : h.set(d, e), I = (d, h, e, t) => (E(d, h, "write to private field"), t ? t.call(d, e) : h.set(d, e), e);
|
1
6
|
import "../icon/icon.js";
|
2
|
-
import { computePosition as
|
3
|
-
import { FormBase as
|
7
|
+
import { computePosition as T, flip as B, offset as x } from "@floating-ui/dom";
|
8
|
+
import { FormBase as R } from "../../internal/components/formBase.js";
|
4
9
|
import "../../internal/components/hint/hint.js";
|
5
|
-
import { PopoverController as
|
6
|
-
import { hintSeverity as
|
7
|
-
import { watch as
|
8
|
-
import { Asterisk as
|
9
|
-
import { Temporal as
|
10
|
-
import { componentStyles as
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
10
|
+
import { PopoverController as A } from "../../internal/controllers/popover.controller.js";
|
11
|
+
import { hintSeverity as L } from "../../internal/helpers/hintSeverity.js";
|
12
|
+
import { watch as j } from "../../internal/helpers/watch.js";
|
13
|
+
import { Asterisk as V } from "../../internal/templates/asterisk.js";
|
14
|
+
import { Temporal as O } from "@js-temporal/polyfill";
|
15
|
+
import { componentStyles as q } from "../../styles/component.styles.js";
|
16
|
+
import { LocalizeController as U } from "../../utilities/localize.js";
|
17
|
+
import { nothing as g, html as _ } from "lit";
|
18
|
+
import { property as p, state as w, query as D, queryAssignedNodes as N } from "lit/decorators.js";
|
19
|
+
import { ifDefined as v } from "lit/directives/if-defined.js";
|
20
|
+
import { live as M } from "lit/directives/live.js";
|
15
21
|
import "./datepicker-popup.js";
|
16
|
-
import { dateFormatter as
|
17
|
-
import { styles as
|
18
|
-
var
|
19
|
-
for (var
|
20
|
-
(
|
21
|
-
return
|
22
|
-
};
|
23
|
-
const
|
22
|
+
import { dateFormatter as m, is as y, isPopoverOpen as Y, debounce as z } from "./datepicker.helpers.js";
|
23
|
+
import { styles as W } from "./datepicker.styles.js";
|
24
|
+
var H = Object.defineProperty, K = Object.getOwnPropertyDescriptor, r = (d, h, e, t) => {
|
25
|
+
for (var a = t > 1 ? void 0 : t ? K(h, e) : h, l = d.length - 1, n; l >= 0; l--)
|
26
|
+
(n = d[l]) && (a = (t ? n(h, e, a) : n(a)) || a);
|
27
|
+
return t && a && H(h, e, a), a;
|
28
|
+
}, b;
|
29
|
+
const F = class F extends R {
|
24
30
|
constructor() {
|
25
|
-
super()
|
31
|
+
super();
|
32
|
+
C(this, b);
|
33
|
+
I(this, b, new U(this)), this.popoverController = new A(this), this.id = "skf-datepicker-input", this.lang = "en", 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
34
|
this.pristine = !1, this._internals.setFormValue(this.value ?? ""), this.validateInput();
|
27
35
|
}, this._handleDateSelected = (e) => {
|
28
36
|
if (this.range && "start" in e.detail.date && "end" in e.detail.date) {
|
29
37
|
const t = e.detail.date.start, a = e.detail.date.end;
|
30
|
-
this.value = `${
|
31
|
-
} else !this.range && e.detail.date instanceof Date && (this.value =
|
38
|
+
this.value = `${m(t)},${m(a)}`, this.selectedRangeDates = { start: t, end: a };
|
39
|
+
} else !this.range && e.detail.date instanceof Date && (this.value = m(e.detail.date), this._animatePopover({ el: this.$popover, show: !1 }).then(() => {
|
32
40
|
this.$popover.hidePopover();
|
33
41
|
}));
|
34
42
|
}, this._handleKeyboardEvents = (e) => {
|
35
|
-
var a,
|
43
|
+
var a, l;
|
36
44
|
const t = e.target.closest("input");
|
37
45
|
if (t) {
|
38
46
|
if ((t.selectionStart ?? 0) < t.value.length && /[[0-9-]/.test(e.key)) {
|
39
|
-
const n = t.selectionStart ?? 0,
|
40
|
-
t.value =
|
47
|
+
const n = t.selectionStart ?? 0, c = t.value.split("").slice(0, n);
|
48
|
+
t.value = c.join("");
|
41
49
|
}
|
42
50
|
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
51
|
e.preventDefault();
|
44
|
-
const
|
45
|
-
|
52
|
+
const u = (a = this.$popover.childNodes[1].shadowRoot) == null ? void 0 : a.querySelector("skf-datepicker-calendar"), c = (l = u == null ? void 0 : u.shadowRoot) == null ? void 0 : l.querySelector("button");
|
53
|
+
c == null || c.focus();
|
46
54
|
}
|
47
55
|
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
56
|
if (t.blur(), this.$popover.hidePopover(), this.range) {
|
49
|
-
const n = this.$input.value,
|
50
|
-
if (!
|
57
|
+
const n = this.$input.value, u = this.$input_range_end.value;
|
58
|
+
if (!y(n, u).date()) return;
|
51
59
|
this.$datepickerPopup.selectedDateRange = {
|
52
60
|
start: new Date(n),
|
53
|
-
end: new Date(
|
61
|
+
end: new Date(u)
|
54
62
|
}, this.$datepickerPopup.emit("selected-date-changed", {
|
55
63
|
detail: { date: new Date(n) }
|
56
64
|
});
|
57
65
|
} else {
|
58
|
-
if (!t.value || !
|
66
|
+
if (!t.value || !y(t.value).date()) return;
|
59
67
|
this.$datepickerPopup.emit("selected-date-changed", {
|
60
68
|
detail: { date: new Date(t.value) }
|
61
69
|
});
|
@@ -72,14 +80,14 @@ const _ = class _ extends C {
|
|
72
80
|
this.value = "", this.$datepickerPopup.clearSelection();
|
73
81
|
}, this._handleInput = (e) => {
|
74
82
|
const t = e.target, a = String(t.value).replace(/[^0-9-]/g, "");
|
75
|
-
if (t.value = a, t.setCustomValidity(this.customError ?? ""), !!
|
83
|
+
if (t.value = a, t.setCustomValidity(this.customError ?? ""), !!y(t.value).ISO()) {
|
76
84
|
if (this.focusTimeoutId && clearTimeout(this.focusTimeoutId), this.$datepickerPopup.date = t.value, this.range) {
|
77
85
|
this.$datepickerPopup.selectedDateRange = {
|
78
|
-
start:
|
79
|
-
end:
|
86
|
+
start: y(this.$input.value).ISO() ? new Date(this.$input.value) : null,
|
87
|
+
end: y(this.$input_range_end.value).ISO() ? new Date(this.$input_range_end.value) : null
|
80
88
|
};
|
81
|
-
const
|
82
|
-
this.value =
|
89
|
+
const l = Object.values(this.$datepickerPopup.selectedDateRange).filter(Boolean).map((n) => new Date(n).toLocaleDateString("en-CA")).join();
|
90
|
+
this.value = l, y(this.$input.value).ISO() && (this.focusTimeoutId = setTimeout(() => {
|
83
91
|
this.$input_range_end.focus();
|
84
92
|
}, 200));
|
85
93
|
} else
|
@@ -91,9 +99,9 @@ const _ = class _ extends C {
|
|
91
99
|
}, this._toggleClearButton = (e = !1) => {
|
92
100
|
this.showClearbutton = e;
|
93
101
|
}, this.reposition = async () => {
|
94
|
-
const { x: e, y: t } = await
|
102
|
+
const { x: e, y: t } = await T(this.$anchor, this.$popover, {
|
95
103
|
placement: "bottom-start",
|
96
|
-
middleware: [
|
104
|
+
middleware: [B(), x(0)],
|
97
105
|
strategy: "fixed"
|
98
106
|
});
|
99
107
|
Object.assign(this.$popover.style, {
|
@@ -119,7 +127,7 @@ const _ = class _ extends C {
|
|
119
127
|
}
|
120
128
|
firstUpdated() {
|
121
129
|
var e;
|
122
|
-
this.$datepickerPopup.date = this._init_date ?
|
130
|
+
this.$datepickerPopup.date = this._init_date ? O.PlainDate.from(this._init_date).toString() : O.Now.plainDateISO().toString(), this.range ? this.$datepickerPopup.selectedDateRange = {
|
123
131
|
start: this._init_date ? new Date(this._init_date) : null,
|
124
132
|
end: (e = this.value) != null && e.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
125
133
|
} : 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();
|
@@ -133,15 +141,15 @@ const _ = class _ extends C {
|
|
133
141
|
this._internals.setValidity({}), this.validateInput();
|
134
142
|
}
|
135
143
|
_handleValueChange() {
|
136
|
-
var e, t, a,
|
137
|
-
(e = this.value) != null && e.trim() || this.$datepickerPopup.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value =
|
144
|
+
var e, t, a, l, n, u, c, i;
|
145
|
+
(e = this.value) != null && e.trim() || this.$datepickerPopup.clearSelection(), this._internals.setFormValue(this.value ?? ""), this.validateInput(), this._pristine = !1, this.$input.value = m((t = this.value) == null ? void 0 : t.split(",")[0]), this.range ? (this.$datepickerPopup.selectedDateRange = {
|
138
146
|
start: (n = this.value) != null && n.split(",")[0] ? new Date(this.value.split(",")[0]) : null,
|
139
|
-
end: (
|
140
|
-
}, this.$input_range_end.value =
|
147
|
+
end: (u = this.value) != null && u.split(",")[1] ? new Date(this.value.split(",")[1]) : null
|
148
|
+
}, this.$input_range_end.value = m((c = this.value) == null ? void 0 : c.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 = ((l = this.value) == null ? void 0 : l.split(",")[0]) ?? ""), this.validateInput();
|
141
149
|
}
|
142
150
|
showPopover() {
|
143
|
-
if (
|
144
|
-
|
151
|
+
if (Y(this.$popover)) return;
|
152
|
+
z(() => {
|
145
153
|
this.$popover.showPopover(), this._animatePopover({ show: !0 });
|
146
154
|
}, 200)(), this.addEventListener("focusout", this.hidePopover.bind(this), {
|
147
155
|
once: !0,
|
@@ -161,19 +169,19 @@ const _ = class _ extends C {
|
|
161
169
|
/** @internal */
|
162
170
|
async _animatePopover({ el: e = this.$popover, show: t }) {
|
163
171
|
return t && (e.style.opacity = "0", e.style.transform = "scaleY(0.5)"), new Promise((a) => {
|
164
|
-
const
|
172
|
+
const l = [
|
165
173
|
{ opacity: 0, transform: "scaleY(0.5)" },
|
166
174
|
{ opacity: 1, transform: "scaleY(1)" }
|
167
|
-
], n = t ?
|
175
|
+
], n = t ? l : l.reverse();
|
168
176
|
setTimeout(
|
169
177
|
() => {
|
170
178
|
e.style.transformOrigin = "top";
|
171
|
-
const
|
179
|
+
const u = this.$popover.animate(n, {
|
172
180
|
duration: 100,
|
173
181
|
easing: "linear",
|
174
182
|
fill: "both"
|
175
183
|
});
|
176
|
-
|
184
|
+
u.onfinish = () => {
|
177
185
|
a();
|
178
186
|
};
|
179
187
|
},
|
@@ -186,20 +194,20 @@ const _ = class _ extends C {
|
|
186
194
|
if (this._internals.validity.customError) return;
|
187
195
|
let t = JSON.parse(JSON.stringify(this._internals.validity)), a = {};
|
188
196
|
if (this.selectableFrom) {
|
189
|
-
const { validityFragment: i, errorMessageFragment:
|
190
|
-
t = { ...t, ...i }, a = { ...a, ...
|
197
|
+
const { validityFragment: i, errorMessageFragment: o } = l(this);
|
198
|
+
t = { ...t, ...i }, a = { ...a, ...o };
|
191
199
|
}
|
192
200
|
if (this.selectableTo) {
|
193
|
-
const { validityFragment: i, errorMessageFragment:
|
194
|
-
t = { ...t, ...i }, a = { ...a, ...
|
201
|
+
const { validityFragment: i, errorMessageFragment: o } = n(this);
|
202
|
+
t = { ...t, ...i }, a = { ...a, ...o };
|
195
203
|
}
|
196
204
|
if (this.range) {
|
197
|
-
const { validityFragment: i, errorMessageFragment:
|
198
|
-
t = { ...t, ...i }, a = { ...a, ...
|
205
|
+
const { validityFragment: i, errorMessageFragment: o } = u(this);
|
206
|
+
t = { ...t, ...i }, a = { ...a, ...o };
|
199
207
|
}
|
200
208
|
if (this.required) {
|
201
|
-
const { validityFragment: i, errorMessageFragment:
|
202
|
-
t = { ...t, ...i }, a = { ...a, ...
|
209
|
+
const { validityFragment: i, errorMessageFragment: o } = c(this);
|
210
|
+
t = { ...t, ...i }, a = { ...a, ...o };
|
203
211
|
}
|
204
212
|
if (t.valid = !Object.values(t).some((i) => i), this.invalid = !1, t.valid)
|
205
213
|
this._internals.setValidity({ customError: this._internals.validity.customError }), this.hint = this.getAttribute("hint") ?? "";
|
@@ -207,66 +215,66 @@ const _ = class _ extends C {
|
|
207
215
|
this.invalid = !this._pristine && !t.valid;
|
208
216
|
let i;
|
209
217
|
for (i in t) {
|
210
|
-
const
|
218
|
+
const o = `data-${i.toString()}`;
|
211
219
|
if (t[i]) {
|
212
220
|
this.validationError = i.toString();
|
213
|
-
const
|
221
|
+
const f = this.hasAttribute(o) ? this.getAttribute(o) : a[i];
|
214
222
|
this._internals.setValidity(
|
215
223
|
{ [this.validationError]: !0, customError: this._internals.validity.customError },
|
216
|
-
this.withFallback(
|
217
|
-
),
|
224
|
+
this.withFallback(f)
|
225
|
+
), f && !this._pristine && (this.hint = f), this.invalid && this.customErrorDisplay && this.checkValidity();
|
218
226
|
}
|
219
227
|
}
|
220
228
|
}
|
221
|
-
function
|
222
|
-
const
|
223
|
-
if (!i.selectableFrom) return
|
224
|
-
const
|
225
|
-
if (new Date(i.$input.value) <
|
226
|
-
const
|
229
|
+
function l(i) {
|
230
|
+
const o = { validityFragment: {}, errorMessageFragment: {} };
|
231
|
+
if (!i.selectableFrom) return o;
|
232
|
+
const f = new Date(i.selectableFrom);
|
233
|
+
if (new Date(i.$input.value) < f) {
|
234
|
+
const $ = i.getAttribute("data-rangeunderflow") ?? `Date is out of range. Earliest selectable date is ${i.selectableFrom}.`;
|
227
235
|
return {
|
228
236
|
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
229
|
-
errorMessageFragment: { rangeUnderflow:
|
237
|
+
errorMessageFragment: { rangeUnderflow: $ }
|
230
238
|
};
|
231
239
|
}
|
232
|
-
return
|
240
|
+
return o;
|
233
241
|
}
|
234
242
|
function n(i) {
|
235
|
-
const
|
236
|
-
if (!i.selectableTo) return
|
237
|
-
const
|
238
|
-
if (new Date(i.$input.value) >
|
239
|
-
const
|
243
|
+
const o = { validityFragment: {}, errorMessageFragment: {} };
|
244
|
+
if (!i.selectableTo) return o;
|
245
|
+
const f = new Date(i.selectableTo);
|
246
|
+
if (new Date(i.$input.value) > f) {
|
247
|
+
const $ = i.getAttribute("data-rangeoverflow") ?? `Date is out of range. Latest selectable date is ${i.selectableTo}.`;
|
240
248
|
return {
|
241
249
|
validityFragment: { rangeOverflow: !0, valid: !1 },
|
242
|
-
errorMessageFragment: { rangeOverflow:
|
250
|
+
errorMessageFragment: { rangeOverflow: $ }
|
243
251
|
};
|
244
252
|
}
|
245
|
-
return
|
253
|
+
return o;
|
246
254
|
}
|
247
|
-
function
|
248
|
-
const
|
249
|
-
if (new Date(i.$input_range_end.value) <
|
250
|
-
const
|
255
|
+
function u(i) {
|
256
|
+
const o = { validityFragment: {}, errorMessageFragment: {} }, f = new Date(i.$input.value);
|
257
|
+
if (new Date(i.$input_range_end.value) < f) {
|
258
|
+
const $ = i.getAttribute("data-rangeunderflow") ?? "End date cannot be before start date";
|
251
259
|
return {
|
252
260
|
validityFragment: { rangeUnderflow: !0, valid: !1 },
|
253
|
-
errorMessageFragment: { rangeUnderflow:
|
261
|
+
errorMessageFragment: { rangeUnderflow: $ }
|
254
262
|
};
|
255
263
|
}
|
256
|
-
return
|
264
|
+
return o;
|
257
265
|
}
|
258
|
-
function
|
259
|
-
const
|
266
|
+
function c(i) {
|
267
|
+
const o = { validityFragment: {}, errorMessageFragment: {} };
|
260
268
|
return !i.$input.value || i.range && !i.$input_range_end.value ? {
|
261
269
|
validityFragment: { valueMissing: !0, valid: !1 },
|
262
270
|
errorMessageFragment: { valueMissing: "This field is required" }
|
263
|
-
} :
|
271
|
+
} : o;
|
264
272
|
}
|
265
273
|
}
|
266
274
|
render() {
|
267
|
-
var t, a,
|
275
|
+
var t, a, l, n, u, c, i, o;
|
268
276
|
const e = (this._defaultSlot.length === 0 || !((a = (t = this._defaultSlot[0]) == null ? void 0 : t.textContent) != null && a.trim())) && !this.label;
|
269
|
-
return
|
277
|
+
return _`
|
270
278
|
<div
|
271
279
|
id="root"
|
272
280
|
@mouseenter=${() => {
|
@@ -279,74 +287,76 @@ const _ = class _ extends C {
|
|
279
287
|
<label>
|
280
288
|
<div class=${this.hideLabel ? "visually-hidden" : ""} ?hidden=${e} id="label">
|
281
289
|
<slot>${this.label}</slot>
|
282
|
-
${this.required ?
|
290
|
+
${this.required ? V(k(this, b).term("required")) : g}
|
283
291
|
</div>
|
284
292
|
<div id="input">
|
285
293
|
<input
|
286
294
|
?disabled=${this.disabled}
|
287
295
|
?readonly=${this.readonly}
|
288
|
-
.value=${
|
289
|
-
this.range ?
|
296
|
+
.value=${M(
|
297
|
+
this.range ? m((l = this.value) == null ? void 0 : l.split(",")[0]) : m(this.value)
|
290
298
|
)}
|
291
299
|
@blur=${this._handleBlur}
|
292
300
|
@click=${this._handleFocus}
|
293
301
|
@focus=${this._handleFocus}
|
294
302
|
@input=${this._handleInput}
|
295
303
|
@keydown=${this._handleKeyboardEvents}
|
296
|
-
aria-describedby=${
|
297
|
-
aria-errormessage=${
|
304
|
+
aria-describedby=${v((n = this.hint) != null && n.trim() ? "hint" : g)}
|
305
|
+
aria-errormessage=${v((u = this.hint) != null && u.trim() ? "hint" : g)}
|
298
306
|
aria-invalid=${!!this.invalid}
|
299
307
|
autocomplete="off"
|
300
308
|
data-testid="field-input"
|
301
|
-
inputmode=${
|
309
|
+
inputmode=${v(this.inputMode)}
|
302
310
|
maxlength="10"
|
303
311
|
name=${this.name ?? "calendar"}
|
304
|
-
placeholder=${
|
312
|
+
placeholder=${v(this.placeholder)}
|
305
313
|
type="text"
|
306
314
|
/>
|
307
|
-
${this.range ?
|
315
|
+
${this.range ? _`
|
308
316
|
<skf-icon name="arrowRight"></skf-icon>
|
309
317
|
<input
|
310
318
|
?disabled=${this.disabled}
|
311
319
|
?readonly=${this.readonly}
|
312
|
-
.value=${
|
320
|
+
.value=${M(m((c = this.value) == null ? void 0 : c.split(",")[1]))}
|
313
321
|
@blur=${this._handleBlur}
|
314
322
|
@click=${this._handleFocus}
|
315
323
|
@focus=${this._handleFocus}
|
316
324
|
@input=${this._handleInput}
|
317
325
|
@keydown=${this._handleKeyboardEvents}
|
318
|
-
aria-describedby=${
|
319
|
-
aria-errormessage=${
|
326
|
+
aria-describedby=${v((i = this.hint) != null && i.trim() ? "hint" : g)}
|
327
|
+
aria-errormessage=${v((o = this.hint) != null && o.trim() ? "hint" : g)}
|
320
328
|
aria-invalid=${!!this.invalid}
|
321
329
|
autocomplete="off"
|
322
330
|
data-testid="field-input-range-end"
|
323
|
-
inputmode=${
|
331
|
+
inputmode=${v(this.inputMode)}
|
324
332
|
maxlength="10"
|
325
333
|
name=${(this.name ?? "calendar") + "-end"}
|
326
|
-
placeholder=${
|
334
|
+
placeholder=${v(this.placeholder)}
|
327
335
|
type="text"
|
328
336
|
/>
|
329
337
|
` : g}
|
330
|
-
${this.showClearbutton ?
|
338
|
+
${this.showClearbutton ? _`
|
331
339
|
<button
|
340
|
+
aria-label=${k(this, b).term("close")}
|
332
341
|
class="password skf-icon-host"
|
333
342
|
type="button"
|
334
343
|
@click=${this.clear.bind(this)}
|
335
344
|
>
|
336
345
|
<skf-icon name="close" size="sm"></skf-icon>
|
337
346
|
</button>
|
338
|
-
` :
|
347
|
+
` : _`
|
339
348
|
<button class="password skf-icon-host" type="button">
|
340
349
|
<skf-icon name="calendarMonth" size="sm"></skf-icon>
|
341
350
|
</button>
|
342
351
|
`}
|
343
352
|
</div>
|
344
353
|
</label>
|
345
|
-
${this.hint &&
|
354
|
+
${this.hint && _`
|
346
355
|
<skf-hint
|
356
|
+
?disabled=${this.disabled}
|
347
357
|
aria-live=${this.invalid ? "assertive" : "polite"}
|
348
358
|
id="hint"
|
349
|
-
severity=${
|
359
|
+
severity=${v(L(this.invalid, this.severity))}
|
350
360
|
>${this.customInvalid ?? this.hint}
|
351
361
|
</skf-hint>
|
352
362
|
`}
|
@@ -356,99 +366,100 @@ const _ = class _ extends C {
|
|
356
366
|
<skf-datepicker-popup
|
357
367
|
?range=${this.range}
|
358
368
|
id=${this.id}
|
359
|
-
invalid-dates=${
|
360
|
-
|
361
|
-
selectable-
|
369
|
+
invalid-dates=${v(this.invalidDates)}
|
370
|
+
lang=${this.lang}
|
371
|
+
selectable-from=${v(this.selectableFrom)}
|
372
|
+
selectable-to=${v(this.selectableTo)}
|
362
373
|
></skf-datepicker-popup>
|
363
374
|
</div>
|
364
375
|
`;
|
365
376
|
}
|
366
377
|
};
|
367
|
-
|
368
|
-
let s =
|
378
|
+
b = new WeakMap(), F.styles = [q, W];
|
379
|
+
let s = F;
|
369
380
|
r([
|
370
|
-
|
381
|
+
p({ attribute: "custom-invalid", reflect: !0 })
|
371
382
|
], s.prototype, "customInvalid", 1);
|
372
383
|
r([
|
373
|
-
|
384
|
+
p({ type: String })
|
374
385
|
], s.prototype, "id", 2);
|
375
386
|
r([
|
376
|
-
|
387
|
+
p()
|
377
388
|
], s.prototype, "label", 2);
|
378
389
|
r([
|
379
|
-
|
390
|
+
p({ type: String })
|
391
|
+
], s.prototype, "lang", 2);
|
392
|
+
r([
|
393
|
+
p({ type: Boolean, attribute: "hide-label" })
|
380
394
|
], s.prototype, "hideLabel", 2);
|
381
395
|
r([
|
382
|
-
|
396
|
+
p()
|
383
397
|
], s.prototype, "hint", 2);
|
384
398
|
r([
|
385
|
-
|
399
|
+
p({ attribute: "invalid-dates" })
|
386
400
|
], s.prototype, "invalidDates", 2);
|
387
401
|
r([
|
388
|
-
|
402
|
+
p({ reflect: !0 })
|
389
403
|
], s.prototype, "name", 2);
|
390
404
|
r([
|
391
|
-
|
405
|
+
p()
|
392
406
|
], s.prototype, "placeholder", 2);
|
393
407
|
r([
|
394
|
-
|
408
|
+
p({ type: Boolean })
|
395
409
|
], s.prototype, "range", 2);
|
396
410
|
r([
|
397
|
-
|
411
|
+
p({ type: Boolean })
|
398
412
|
], s.prototype, "readonly", 2);
|
399
413
|
r([
|
400
|
-
|
401
|
-
], s.prototype, "requiredLabel", 2);
|
402
|
-
r([
|
403
|
-
h({ attribute: "selectable-from" })
|
414
|
+
p({ attribute: "selectable-from" })
|
404
415
|
], s.prototype, "selectableFrom", 2);
|
405
416
|
r([
|
406
|
-
|
417
|
+
p({ attribute: "selectable-to" })
|
407
418
|
], s.prototype, "selectableTo", 2);
|
408
419
|
r([
|
409
|
-
|
420
|
+
p({ reflect: !0 })
|
410
421
|
], s.prototype, "severity", 2);
|
411
422
|
r([
|
412
|
-
|
423
|
+
p({ reflect: !0 })
|
413
424
|
], s.prototype, "size", 2);
|
414
425
|
r([
|
415
|
-
|
426
|
+
p({ type: String, attribute: "validate-on" })
|
416
427
|
], s.prototype, "validateOn", 2);
|
417
428
|
r([
|
418
|
-
|
429
|
+
p()
|
419
430
|
], s.prototype, "value", 2);
|
420
431
|
r([
|
421
|
-
|
432
|
+
w()
|
422
433
|
], s.prototype, "_init_date", 2);
|
423
434
|
r([
|
424
|
-
|
435
|
+
p({ type: Boolean, reflect: !0 })
|
425
436
|
], s.prototype, "invalid", 2);
|
426
437
|
r([
|
427
|
-
|
438
|
+
w()
|
428
439
|
], s.prototype, "selectedRangeDates", 2);
|
429
440
|
r([
|
430
|
-
|
441
|
+
w()
|
431
442
|
], s.prototype, "showClearbutton", 2);
|
432
443
|
r([
|
433
|
-
|
444
|
+
D("#popover")
|
434
445
|
], s.prototype, "$popover", 2);
|
435
446
|
r([
|
436
|
-
|
447
|
+
D("#input")
|
437
448
|
], s.prototype, "$anchor", 2);
|
438
449
|
r([
|
439
|
-
|
450
|
+
D('input[data-testid="field-input"]')
|
440
451
|
], s.prototype, "$input", 2);
|
441
452
|
r([
|
442
|
-
|
453
|
+
D('input[data-testid="field-input-range-end"]')
|
443
454
|
], s.prototype, "$input_range_end", 2);
|
444
455
|
r([
|
445
|
-
|
456
|
+
D("skf-datepicker-popup")
|
446
457
|
], s.prototype, "$datepickerPopup", 2);
|
447
458
|
r([
|
448
|
-
|
459
|
+
N({ flatten: !0 })
|
449
460
|
], s.prototype, "_defaultSlot", 2);
|
450
461
|
r([
|
451
|
-
|
462
|
+
j("value", { waitUntilFirstUpdate: !0, afterUpdate: !0 })
|
452
463
|
], s.prototype, "_handleValueChange", 1);
|
453
464
|
export {
|
454
465
|
s as SkfDatepicker
|
@@ -2,6 +2,7 @@ import '../button/button.js';
|
|
2
2
|
import '../heading/heading.js';
|
3
3
|
import '../icon/icon.js';
|
4
4
|
import { SkfElement } from '../../internal/components/skf-element';
|
5
|
+
import { type Language } from '../../utilities/localize.js';
|
5
6
|
import { type CSSResultGroup } from 'lit';
|
6
7
|
/**
|
7
8
|
* The `<skf-dialog>` is a component that open up a dialog of type modal with the content provided. (MDN refrains from opening the dialog using the `open` attribute, however skf-dialog does not have that limitation)
|
@@ -23,12 +24,12 @@ import { type CSSResultGroup } from 'lit';
|
|
23
24
|
export declare class SkfDialog extends SkfElement {
|
24
25
|
#private;
|
25
26
|
static styles: CSSResultGroup;
|
26
|
-
/** If defined, sets the aria-label for the close button */
|
27
|
-
closeButtonAriaLabel?: string;
|
28
27
|
/** Title for the modal/dialog */
|
29
28
|
heading?: string;
|
30
29
|
/** If true, makes the dialog stretch edge to edge on screen */
|
31
30
|
fullscreen: boolean;
|
31
|
+
/** Sets the internal language of the component */
|
32
|
+
lang: Language;
|
32
33
|
/** If true, removes the close button */
|
33
34
|
noCloseButton?: boolean | undefined;
|
34
35
|
/** If defined, removes the inner padding */
|