@skf-design-system/ui-components 1.0.2-beta.1 → 1.0.2-beta.10
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 +15 -18
- package/dist/components/link/link.component.js +104 -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/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 +1681 -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 +1988 -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 +38 -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,21 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import { SkfElement as O } from "../../internal/components/skf-element.js";
|
4
|
-
import { watch as R } from "../../internal/helpers/watch.js";
|
5
|
-
import { Temporal as m } from "@js-temporal/polyfill";
|
6
|
-
import { componentStyles as C } from "../../styles/component.styles.js";
|
7
|
-
import { html as p } from "lit";
|
8
|
-
import { property as g, state as M } from "lit/decorators.js";
|
9
|
-
import { repeat as w } from "lit/directives/repeat.js";
|
10
|
-
import { styles as F } from "./datepicker.calendar.styles.js";
|
11
|
-
var A = Object.defineProperty, P = Object.getOwnPropertyDescriptor, d = (D, t, e, a) => {
|
12
|
-
for (var s = a > 1 ? void 0 : a ? P(t, e) : t, i = D.length - 1, h; i >= 0; i--)
|
13
|
-
(h = D[i]) && (s = (a ? h(t, e, s) : h(s)) || s);
|
14
|
-
return a && s && A(t, e, s), s;
|
1
|
+
var _ = (n) => {
|
2
|
+
throw TypeError(n);
|
15
3
|
};
|
16
|
-
|
4
|
+
var w = (n, r, t) => r.has(n) || _("Cannot " + t);
|
5
|
+
var f = (n, r, t) => (w(n, r, "read from private field"), t ? t.call(n) : r.get(n)), S = (n, r, t) => r.has(n) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, t), $ = (n, r, t, e) => (w(n, r, "write to private field"), e ? e.call(n, t) : r.set(n, t), t);
|
6
|
+
import { SkfElement as L } from "../../internal/components/skf-element.js";
|
7
|
+
import { watch as O } from "../../internal/helpers/watch.js";
|
8
|
+
import { Temporal as c } from "@js-temporal/polyfill";
|
9
|
+
import { componentStyles as x } from "../../styles/component.styles.js";
|
10
|
+
import { LocalizeController as R } from "../../utilities/localize.js";
|
11
|
+
import { html as g } from "lit";
|
12
|
+
import { property as d, state as M } from "lit/decorators.js";
|
13
|
+
import { repeat as y } from "lit/directives/repeat.js";
|
14
|
+
import { styles as C } from "./datepicker-calendar.styles.js";
|
15
|
+
import { compareDates as E } from "./datepicker-popup.helpers.js";
|
16
|
+
import { dateFormatter as D } from "./datepicker.helpers.js";
|
17
|
+
var F = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (n, r, t, e) => {
|
18
|
+
for (var a = e > 1 ? void 0 : e ? A(r, t) : r, s = n.length - 1, i; s >= 0; s--)
|
19
|
+
(i = n[s]) && (a = (e ? i(r, t, a) : i(a)) || a);
|
20
|
+
return e && a && F(r, t, a), a;
|
21
|
+
}, u;
|
22
|
+
const b = class b extends L {
|
17
23
|
constructor() {
|
18
|
-
super(...arguments)
|
24
|
+
super(...arguments);
|
25
|
+
S(this, u);
|
26
|
+
$(this, u, new R(this)), this._secondCalendarOffset = 0, this.date = /* @__PURE__ */ new Date(), this.firstDayOfWeek = 0, this.lang = "en", this.locale = "en-CA", this.range = !1, this.selectedDate = void 0, this.selectedDateRange = {
|
19
27
|
start: null,
|
20
28
|
end: null
|
21
29
|
}, this._numberOfDays = 0, this._numberOfDaysLastMonth = 0, this._listenToKeyboard = () => ({
|
@@ -26,33 +34,22 @@ const E = class E extends O {
|
|
26
34
|
this.removeEventListener("keydown", this._handleKeyDown);
|
27
35
|
}
|
28
36
|
}), this._handleKeyDown = (t) => {
|
29
|
-
var s, i, h, v, _, S, b;
|
30
37
|
const { key: e } = t;
|
31
|
-
if ((e === "ArrowRight" || e === "ArrowLeft" || e === "ArrowDown" || e === "ArrowUp") && t.preventDefault(), e === "ArrowRight") {
|
32
|
-
const
|
33
|
-
|
34
|
-
}
|
35
|
-
if (e === "ArrowLeft") {
|
36
|
-
const n = (i = this.shadowRoot) == null ? void 0 : i.activeElement, r = n == null ? void 0 : n.parentElement, c = r == null ? void 0 : r.previousElementSibling, l = c == null ? void 0 : c.firstElementChild;
|
37
|
-
l == null || l.focus();
|
38
|
-
}
|
39
|
-
if (e === "ArrowDown") {
|
40
|
-
const n = (h = this.shadowRoot) == null ? void 0 : h.activeElement, r = n == null ? void 0 : n.parentElement, c = a(r), l = (v = r == null ? void 0 : r.parentElement) == null ? void 0 : v.children[c + 7], f = l == null ? void 0 : l.firstElementChild;
|
41
|
-
f == null || f.focus();
|
38
|
+
if ((e === "ArrowRight" || e === "ArrowLeft" || e === "ArrowDown" || e === "ArrowUp") && t.preventDefault(), e === "ArrowRight" && this.shadowRoot?.activeElement?.parentElement?.nextElementSibling?.firstElementChild?.focus(), e === "ArrowLeft" && this.shadowRoot?.activeElement?.parentElement?.previousElementSibling?.firstElementChild?.focus(), e === "ArrowDown") {
|
39
|
+
const h = this.shadowRoot?.activeElement?.parentElement, m = a(h);
|
40
|
+
h?.parentElement?.children[m + 7]?.firstElementChild?.focus();
|
42
41
|
}
|
43
42
|
if (e === "ArrowUp") {
|
44
|
-
const
|
45
|
-
if (!
|
46
|
-
const
|
47
|
-
|
43
|
+
const h = this.shadowRoot?.activeElement?.parentElement;
|
44
|
+
if (!h) return;
|
45
|
+
const m = Array.from(h.parentElement?.children ?? []).indexOf(h);
|
46
|
+
h.parentElement?.children[m - 7]?.firstElementChild?.focus();
|
48
47
|
}
|
49
|
-
function a(
|
50
|
-
|
51
|
-
return u ? Array.from(((n = u.parentElement) == null ? void 0 : n.children) ?? []).indexOf(u) : 0;
|
48
|
+
function a(s) {
|
49
|
+
return s ? Array.from(s.parentElement?.children ?? []).indexOf(s) : 0;
|
52
50
|
}
|
53
51
|
}, this.dateSelectable = (t) => {
|
54
|
-
|
55
|
-
const e = (h = this.invalidDates) == null ? void 0 : h.split(",").includes(t), a = !this.selectableTo || $(t, this.selectableTo) < 0, s = !this.selectableFrom || $(t, this.selectableFrom) > 0;
|
52
|
+
const e = this.invalidDates?.split(",").includes(t), a = !this.selectableTo || E(t, this.selectableTo) < 0, s = !this.selectableFrom || E(t, this.selectableFrom) > 0;
|
56
53
|
return { matchesInvalidDates: e, dateWithinRange: !(a && s) };
|
57
54
|
};
|
58
55
|
}
|
@@ -64,13 +61,12 @@ const E = class E extends O {
|
|
64
61
|
t === "selected-date" && e !== a && (this.selectedDate = new Date(a));
|
65
62
|
}
|
66
63
|
handleDateChange() {
|
67
|
-
|
68
|
-
this._numberOfDays = ((t = this._plainDate(this.date)) == null ? void 0 : t.daysInMonth) ?? 0, this._numberOfDaysLastMonth = ((e = this._plainDate(this.date)) == null ? void 0 : e.subtract({
|
64
|
+
this._numberOfDays = this._plainDate(this.date)?.daysInMonth ?? 0, this._numberOfDaysLastMonth = this._plainDate(this.date)?.subtract({
|
69
65
|
months: 1
|
70
|
-
}).daysInMonth
|
66
|
+
}).daysInMonth ?? 0;
|
71
67
|
}
|
72
68
|
_createDate({ year: t, month: e, day: a = 1 }, s) {
|
73
|
-
switch (e
|
69
|
+
switch (e ??= this.date.getMonth(), t ??= this.date.getFullYear(), !0) {
|
74
70
|
case e < 0:
|
75
71
|
e = 11, t--;
|
76
72
|
break;
|
@@ -80,7 +76,7 @@ const E = class E extends O {
|
|
80
76
|
}
|
81
77
|
if (s)
|
82
78
|
try {
|
83
|
-
return
|
79
|
+
return c.PlainDate.from({
|
84
80
|
year: t,
|
85
81
|
month: e + 1,
|
86
82
|
day: a
|
@@ -100,7 +96,7 @@ const E = class E extends O {
|
|
100
96
|
day: t.getDate()
|
101
97
|
};
|
102
98
|
try {
|
103
|
-
return
|
99
|
+
return c.PlainDate.from(e);
|
104
100
|
} catch (a) {
|
105
101
|
return console.log(e), console.error("error", a), null;
|
106
102
|
}
|
@@ -108,19 +104,19 @@ const E = class E extends O {
|
|
108
104
|
/** @internal Check if a day is between two dates */
|
109
105
|
_isDateBetween(t, e, a) {
|
110
106
|
if (!e || !a) return !1;
|
111
|
-
const s =
|
107
|
+
const s = c.PlainDate.compare(t, e) > 0, i = c.PlainDate.compare(t, a) < 0;
|
112
108
|
return s && i;
|
113
109
|
}
|
114
110
|
render() {
|
115
|
-
return
|
111
|
+
return g`
|
116
112
|
${this.getCalendarHead()}
|
117
113
|
|
118
114
|
<!-- weekdays -->
|
119
115
|
<ul class="weekdays grid">
|
120
|
-
${
|
116
|
+
${y(
|
121
117
|
Array.from({ length: 7 }, (t, e) => e),
|
122
118
|
(t) => t,
|
123
|
-
(t) =>
|
119
|
+
(t) => g`<li>
|
124
120
|
${new Intl.DateTimeFormat(this.locale, {
|
125
121
|
weekday: "short"
|
126
122
|
}).format(new Date(2018, 0, t)).slice(0, 2)}
|
@@ -133,16 +129,16 @@ const E = class E extends O {
|
|
133
129
|
<!-- previous month -->
|
134
130
|
${this.getCalendarPreMonthDays()}
|
135
131
|
<!-- current days -->
|
136
|
-
${
|
132
|
+
${y(
|
137
133
|
Array.from({ length: this._numberOfDays }, (t, e) => e + 1),
|
138
134
|
(t) => t,
|
139
135
|
(t) => {
|
140
136
|
const e = this._createDate({ day: t }, !0).toString(), a = this.returnDayClasses(t);
|
141
|
-
return
|
137
|
+
return g`<li>
|
142
138
|
<button
|
143
139
|
class="day ${a}"
|
144
140
|
data-date=${e}
|
145
|
-
aria-label="
|
141
|
+
aria-label="${f(this, u).term("choose")} ${this._createDate({
|
146
142
|
day: t
|
147
143
|
}).toLocaleDateString(this.locale, {
|
148
144
|
weekday: "long",
|
@@ -169,19 +165,18 @@ const E = class E extends O {
|
|
169
165
|
}
|
170
166
|
/** @internal */
|
171
167
|
returnDayClasses(t) {
|
172
|
-
|
173
|
-
const e = [], a = this._createDate({ day: t }).getDate(), s = ((b = this.selectedDate) == null ? void 0 : b.getMonth()) === this.date.getMonth(), i = ((u = this.selectedDate) == null ? void 0 : u.getFullYear()) === this.date.getFullYear();
|
168
|
+
const e = [], a = this._createDate({ day: t }).getDate(), s = this.selectedDate?.getMonth() === this.date.getMonth(), i = this.selectedDate?.getFullYear() === this.date.getFullYear();
|
174
169
|
this.range && this._isDateBetween(
|
175
170
|
this._createDate({ day: t }, !0),
|
176
171
|
this._plainDate(this.selectedDateRange.start) ?? void 0,
|
177
172
|
this._plainDate(this.selectedDateRange.end) ?? void 0
|
178
|
-
) && e.push("in-range"), this.range && this.selectedDateRange.start && (this.selectedDateRange.start.getFullYear() === this.date.getFullYear() && this.selectedDateRange.start.getMonth() === this.date.getMonth() && this.selectedDateRange.start.getDate() === a && e.push("selected selected-start"),
|
179
|
-
const { matchesInvalidDates: h, dateWithinRange:
|
173
|
+
) && e.push("in-range"), this.range && this.selectedDateRange.start && (this.selectedDateRange.start.getFullYear() === this.date.getFullYear() && this.selectedDateRange.start.getMonth() === this.date.getMonth() && this.selectedDateRange.start.getDate() === a && e.push("selected selected-start"), this.selectedDateRange.end?.getFullYear() === this.date.getFullYear() && this.selectedDateRange.end.getMonth() === this.date.getMonth() && this.selectedDateRange.end.getDate() === a && e.push("selected selected-end"));
|
174
|
+
const { matchesInvalidDates: h, dateWithinRange: m } = this.dateSelectable(
|
180
175
|
this._createDate({ day: t }, !0).toString()
|
181
176
|
);
|
182
|
-
(h ||
|
183
|
-
const
|
184
|
-
return !this.range &&
|
177
|
+
(h || m) && e.push("invalid");
|
178
|
+
const p = this.selectedDate?.getDate() === a;
|
179
|
+
return !this.range && p && s && i && (console.log("is single date selected", this.selectedDate), e.push("selected")), this._createDate({ day: t }, !0).equals(String(this._plainDate(/* @__PURE__ */ new Date()))) && e.push("today"), e.join(" ");
|
185
180
|
}
|
186
181
|
/** @internal */
|
187
182
|
handleSelectDay({
|
@@ -198,7 +193,7 @@ const E = class E extends O {
|
|
198
193
|
}
|
199
194
|
/** @internal */
|
200
195
|
getCalendarPreMonthDays() {
|
201
|
-
return
|
196
|
+
return y(
|
202
197
|
Array.from(
|
203
198
|
{
|
204
199
|
length: this.getCalendarStartDay().getDay()
|
@@ -215,7 +210,7 @@ const E = class E extends O {
|
|
215
210
|
},
|
216
211
|
!0
|
217
212
|
).toString(), { matchesInvalidDates: s, dateWithinRange: i } = this.dateSelectable(a);
|
218
|
-
return (s || i) && e.push("invalid"),
|
213
|
+
return (s || i) && e.push("invalid"), g`<li class="day ">
|
219
214
|
<button
|
220
215
|
class=${e.join(" ")}
|
221
216
|
data-date=${a}
|
@@ -223,8 +218,8 @@ const E = class E extends O {
|
|
223
218
|
this.handleSelectDay({
|
224
219
|
month: this.date.getMonth() - 1,
|
225
220
|
day: t
|
226
|
-
}), this.emit("update-calendar-view", {
|
227
|
-
detail:
|
221
|
+
}), this.emit("skf-update-calendar-view", {
|
222
|
+
detail: c.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
|
228
223
|
});
|
229
224
|
}}"
|
230
225
|
?disabled=${e.includes("invalid")}
|
@@ -237,7 +232,7 @@ const E = class E extends O {
|
|
237
232
|
}
|
238
233
|
/** @internal */
|
239
234
|
getCalendarRemaningDays() {
|
240
|
-
return (this._numberOfDays + this.calendarMonthStartsOn()) % 7 === 0 ? "" :
|
235
|
+
return (this._numberOfDays + this.calendarMonthStartsOn()) % 7 === 0 ? "" : y(
|
241
236
|
Array.from(
|
242
237
|
{
|
243
238
|
length: 7 - this._createDate({
|
@@ -258,7 +253,7 @@ const E = class E extends O {
|
|
258
253
|
},
|
259
254
|
!0
|
260
255
|
).toString(), { matchesInvalidDates: s, dateWithinRange: i } = this.dateSelectable(a);
|
261
|
-
return (s || i) && e.push("invalid"),
|
256
|
+
return (s || i) && e.push("invalid"), g`<li class="day">
|
262
257
|
<button
|
263
258
|
data-date=${a}
|
264
259
|
class=${e.join(" ")}
|
@@ -266,8 +261,8 @@ const E = class E extends O {
|
|
266
261
|
this.handleSelectDay({
|
267
262
|
month: this.date.getMonth() + 1,
|
268
263
|
day: t + 1
|
269
|
-
}), this.emit("update-calendar-view", {
|
270
|
-
detail:
|
264
|
+
}), this.emit("skf-update-calendar-view", {
|
265
|
+
detail: c.PlainDate.from(D(this.date)).add({ months: 1 }).toString()
|
271
266
|
});
|
272
267
|
}}"
|
273
268
|
?disabled=${e.includes("invalid")}
|
@@ -296,27 +291,25 @@ const E = class E extends O {
|
|
296
291
|
}
|
297
292
|
/** @internal */
|
298
293
|
getCalendarHead() {
|
299
|
-
return
|
294
|
+
return g` <div class="calendar-head">
|
300
295
|
<div
|
301
296
|
class="calendar-head-controls${this.range && this.classList.contains("end") ? " hide" : ""}"
|
302
297
|
>
|
303
298
|
<button
|
304
|
-
|
305
|
-
title="Previous year"
|
299
|
+
title=${f(this, u).term("previousYear")}
|
306
300
|
@click="${() => {
|
307
|
-
this.emit("update-calendar-view", {
|
308
|
-
detail:
|
301
|
+
this.emit("skf-update-calendar-view", {
|
302
|
+
detail: c.PlainDate.from(D(this.date)).subtract({ years: 1 }).toString()
|
309
303
|
});
|
310
304
|
}}"
|
311
305
|
>
|
312
306
|
<div style="letter-spacing: -0.2em" aria-hidden="true" data-comp="icon">❮❮</div>
|
313
307
|
</button>
|
314
308
|
<button
|
315
|
-
|
316
|
-
title="Previous month"
|
309
|
+
title=${f(this, u).term("previousMonth")}
|
317
310
|
@click="${() => {
|
318
|
-
this.emit("update-calendar-view", {
|
319
|
-
detail:
|
311
|
+
this.emit("skf-update-calendar-view", {
|
312
|
+
detail: c.PlainDate.from(D(this.date)).subtract({ months: 1 }).toString()
|
320
313
|
});
|
321
314
|
}}"
|
322
315
|
>
|
@@ -325,28 +318,26 @@ const E = class E extends O {
|
|
325
318
|
</div>
|
326
319
|
<h4>
|
327
320
|
${this.date.toLocaleString(this.locale, { month: "short" })}
|
328
|
-
${this.range && this.classList.contains("start") ?
|
321
|
+
${this.range && this.classList.contains("start") ? g` - ` : this.date.getFullYear()}
|
329
322
|
</h4>
|
330
323
|
<div
|
331
324
|
class="calendar-head-controls${this.range && this.classList.contains("start") ? " hide" : ""}"
|
332
325
|
>
|
333
326
|
<button
|
334
|
-
|
335
|
-
title="Next month"
|
327
|
+
title=${f(this, u).term("nextMonth")}
|
336
328
|
@click="${() => {
|
337
|
-
this.emit("update-calendar-view", {
|
338
|
-
detail:
|
329
|
+
this.emit("skf-update-calendar-view", {
|
330
|
+
detail: c.PlainDate.from(D(this.date)).add({ months: 1 + this._secondCalendarOffset }).toString()
|
339
331
|
});
|
340
332
|
}}"
|
341
333
|
>
|
342
334
|
❯
|
343
335
|
</button>
|
344
336
|
<button
|
345
|
-
|
346
|
-
title="Next year"
|
337
|
+
title=${f(this, u).term("nextYear")}
|
347
338
|
@click="${() => {
|
348
|
-
this.emit("update-calendar-view", {
|
349
|
-
detail:
|
339
|
+
this.emit("skf-update-calendar-view", {
|
340
|
+
detail: c.PlainDate.from(D(this.date)).add({ months: 12 + this._secondCalendarOffset }).toString()
|
350
341
|
});
|
351
342
|
}}"
|
352
343
|
>
|
@@ -356,60 +347,63 @@ const E = class E extends O {
|
|
356
347
|
</div>`;
|
357
348
|
}
|
358
349
|
};
|
359
|
-
|
360
|
-
let o =
|
361
|
-
|
362
|
-
|
350
|
+
u = new WeakMap(), b.styles = [x, C];
|
351
|
+
let o = b;
|
352
|
+
l([
|
353
|
+
d({
|
363
354
|
converter: {
|
364
|
-
fromAttribute(
|
365
|
-
return console.log("value", typeof
|
355
|
+
fromAttribute(n) {
|
356
|
+
return console.log("value", typeof n), new Date(n);
|
366
357
|
},
|
367
|
-
toAttribute(
|
368
|
-
return
|
358
|
+
toAttribute(n) {
|
359
|
+
return n.toISOString();
|
369
360
|
}
|
370
361
|
}
|
371
362
|
})
|
372
363
|
], o.prototype, "date", 2);
|
373
|
-
|
374
|
-
|
364
|
+
l([
|
365
|
+
d()
|
375
366
|
], o.prototype, "eventid", 2);
|
376
|
-
|
377
|
-
|
367
|
+
l([
|
368
|
+
d({ type: Number })
|
378
369
|
], o.prototype, "firstDayOfWeek", 2);
|
379
|
-
|
380
|
-
|
370
|
+
l([
|
371
|
+
d({ reflect: !0, attribute: "invalid-dates" })
|
381
372
|
], o.prototype, "invalidDates", 2);
|
382
|
-
|
383
|
-
|
373
|
+
l([
|
374
|
+
d({ type: String })
|
375
|
+
], o.prototype, "lang", 2);
|
376
|
+
l([
|
377
|
+
d({ reflect: !0 })
|
384
378
|
], o.prototype, "locale", 2);
|
385
|
-
|
386
|
-
|
379
|
+
l([
|
380
|
+
d({ type: Boolean })
|
387
381
|
], o.prototype, "range", 2);
|
388
|
-
|
389
|
-
|
382
|
+
l([
|
383
|
+
d({ attribute: "selectable-from" })
|
390
384
|
], o.prototype, "selectableFrom", 2);
|
391
|
-
|
392
|
-
|
385
|
+
l([
|
386
|
+
d({ attribute: "selectable-to" })
|
393
387
|
], o.prototype, "selectableTo", 2);
|
394
|
-
|
395
|
-
|
388
|
+
l([
|
389
|
+
d({
|
396
390
|
attribute: "selected-date",
|
397
|
-
converter: { fromAttribute: (
|
391
|
+
converter: { fromAttribute: (n) => new Date(n) },
|
398
392
|
reflect: !0
|
399
393
|
})
|
400
394
|
], o.prototype, "selectedDate", 2);
|
401
|
-
|
402
|
-
|
395
|
+
l([
|
396
|
+
d({ type: Object })
|
403
397
|
], o.prototype, "selectedDateRange", 2);
|
404
|
-
|
398
|
+
l([
|
405
399
|
M()
|
406
400
|
], o.prototype, "_numberOfDays", 2);
|
407
|
-
|
401
|
+
l([
|
408
402
|
M()
|
409
403
|
], o.prototype, "_numberOfDaysLastMonth", 2);
|
410
|
-
|
411
|
-
|
404
|
+
l([
|
405
|
+
O("date")
|
412
406
|
], o.prototype, "handleDateChange", 1);
|
413
407
|
export {
|
414
|
-
o as
|
408
|
+
o as SkfDatepickerCalendar
|
415
409
|
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { SkfDatepickerCalendar } from './datepicker-calendar.component.js';
|
2
|
+
export * from './datepicker-calendar.component.js';
|
3
|
+
export default SkfDatepickerCalendar;
|
4
|
+
declare global {
|
5
|
+
interface HTMLElementTagNameMap {
|
6
|
+
'skf-datepicker-calendar': SkfDatepickerCalendar;
|
7
|
+
}
|
8
|
+
}
|
@@ -1,27 +1,14 @@
|
|
1
|
-
import '../button/button';
|
1
|
+
import '../button/button.js';
|
2
2
|
import { SkfElement } from '../../internal/components/skf-element.js';
|
3
|
+
import { type Language } from '../../utilities/localize.js';
|
3
4
|
import { type CSSResultGroup } from 'lit';
|
4
|
-
import './datepicker';
|
5
|
-
export interface
|
5
|
+
import './datepicker-calendar.js';
|
6
|
+
export interface SkfDatepickerPopupDateRange {
|
6
7
|
start: Date | null;
|
7
8
|
end: Date | null;
|
8
9
|
}
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
* @element skf-datepicker
|
13
|
-
* @fires selected-date-changed - When a date is selected
|
14
|
-
* @fires selected-date-range-changed - When a range of dates is selected
|
15
|
-
*
|
16
|
-
* @prop {string} date - The date to display in the date picker
|
17
|
-
* @prop {boolean} range - If true, the date picker will allow the selection of a range of dates
|
18
|
-
* @prop {string} locale - The locale to use for formatting the date
|
19
|
-
*
|
20
|
-
* @slot - Default hint content placed inside the date picker
|
21
|
-
*
|
22
|
-
* @cssprop --max-width - The maximum width of the date picker
|
23
|
-
*/
|
24
|
-
export declare class SkfDatePicker extends SkfElement {
|
10
|
+
export declare class SkfDatepickerPopup extends SkfElement {
|
11
|
+
#private;
|
25
12
|
static styles: CSSResultGroup;
|
26
13
|
locale: string;
|
27
14
|
date: string;
|
@@ -30,6 +17,8 @@ export declare class SkfDatePicker extends SkfElement {
|
|
30
17
|
* A comma-separated list of dates (yyyy-mm-dd format) that are not selectable.
|
31
18
|
*/
|
32
19
|
invalidDates?: string;
|
20
|
+
/** Sets the internal language of the component */
|
21
|
+
lang: Language;
|
33
22
|
range: boolean;
|
34
23
|
selectedDate: Date | undefined;
|
35
24
|
/**
|
@@ -40,7 +29,7 @@ export declare class SkfDatePicker extends SkfElement {
|
|
40
29
|
* Latest selectable date. (yyyy-mm-dd format)
|
41
30
|
*/
|
42
31
|
selectableTo?: string;
|
43
|
-
selectedDateRange:
|
32
|
+
selectedDateRange: SkfDatepickerPopupDateRange;
|
44
33
|
/** @internal */
|
45
34
|
private _date?;
|
46
35
|
/** @internal */
|