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