@golemui/gui-lit 1.1.0 → 1.1.1-rc.1
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/CHANGELOG.md +34 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/{calendar-BuJgwvZx.js → calendar-D31xNsxx.js} +72 -59
- package/{calendar.element-M5MPJmap.js → calendar.element-BhFrCsns.js} +22 -20
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-CfFrAtrr.js → currency.element-D8A2ObpM.js} +11 -10
- package/{date-Bj9mI3GU.js → date-DBuYpvcO.js} +35 -27
- package/{date-input-cJDkNnVw.js → date-input-DLiMreSS.js} +64 -44
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/{date-time-calendar-BzRfkLKU.js → date-time-calendar-DzU-FtVl.js} +89 -76
- package/{date-time-calendar.element-DC4NK0y1.js → date-time-calendar.element-BLBcVsFu.js} +13 -11
- package/{date-time-input-BXxsfuyZ.js → date-time-input-DZaz2heD.js} +75 -43
- package/{date-time-picker.element-Dy-8cb-_.js → date-time-picker.element-BUbLdV6i.js} +125 -65
- package/{date-time.element-Bv4XdzMi.js → date-time.element-B5onfSBG.js} +31 -25
- package/{date.element-Consgsbb.js → date.element-BsKhLrEc.js} +22 -19
- package/{day-status-0-hJHrI7.js → day-status-CsWStVQV.js} +153 -129
- package/{dropdown.element-WsD61Qel.js → dropdown.element-CXpMwJsU.js} +19 -13
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/index.js +2933 -2336
- package/index.umd.cjs +798 -405
- package/{list-CrLIL4by.js → list-D730tmGN.js} +115 -116
- package/{list.element-DV82YxnJ.js → list.element-eo3DIOrp.js} +2 -2
- package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
- package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
- package/package.json +9 -6
- package/{part-templates-Db871PS3.js → part-templates-VORbpgs2.js} +132 -118
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/{pill-ranges-DCqDmpkk.js → pill-ranges-DpvWwP-3.js} +12 -12
- package/{pills-Be1UrLgq.js → pills-BDMO2NiR.js} +80 -58
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/{range-calendar-CKPYeSGt.js → range-calendar-DO_woqcF.js} +101 -87
- package/{range-calendar.element-D6KYq18B.js → range-calendar.element-DHLZhpnj.js} +15 -13
- package/{range-date-input-D--AqBMv.js → range-date-input-Br7XqQPK.js} +90 -71
- package/{range-date-input.element-D4nIXJbw.js → range-date-input.element-BdD4SlB4.js} +15 -12
- package/{range-date-picker.element-dhxPAAE6.js → range-date-picker.element-DWRHiAoC.js} +97 -49
- package/{range-date-time-calendar-yksWrR7b.js → range-date-time-calendar-B3EMgN1E.js} +150 -136
- package/{range-date-time-calendar.element-C00aDefZ.js → range-date-time-calendar.element-Coea6RF4.js} +9 -7
- package/{range-date-time-input-B37TUoM3.js → range-date-time-input-Cu-T_nuC.js} +125 -94
- package/{range-date-time-input.element-DUnbv4ed.js → range-date-time-input.element-Cti44iuW.js} +31 -25
- package/{range-date-time-picker.element-Cbps6s_G.js → range-date-time-picker.element-CDN2RL1y.js} +107 -47
- package/{range-time-input-3lhqR1Ku.js → range-time-input-BP9ZL9O8.js} +85 -66
- package/{range-time-input.element-dU2iBdmJ.js → range-time-input.element-B7wtHJoQ.js} +14 -11
- package/{range-time-picker.element-v6nQsIPw.js → range-time-picker.element-CPIAiQPC.js} +92 -51
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-C0V-Bv3L.js → select.element-eepcXTpL.js} +84 -78
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-DvwEpxpK.js → tags.element-CPHgotb0.js} +21 -14
- package/templates-Dmr34nwp.js +88 -0
- package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
- package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
- package/{time-input-BOhlBGJZ.js → time-input-5dkSm8UW.js} +67 -47
- package/{time-list-Czo48bZm.js → time-list-DLcq8BAp.js} +1 -1
- package/{time-picker-bFJ63ky8.js → time-picker-g337F8d0.js} +89 -51
- package/{time-picker.element-CYZVXgRS.js → time-picker.element-DLihegjg.js} +23 -19
- package/{time.element-fK3oLi49.js → time.element-BneqgMlQ.js} +22 -19
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- package/date-picker.element-va_-LGZD.js +0 -312
- package/popup.controller-eUDxE6jD.js +0 -71
- package/templates-Dk1jxLwS.js +0 -75
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { filterTap as C } from "@golemui/core";
|
|
2
|
+
import { html as i, nothing as o } from "lit";
|
|
3
|
+
import { classMap as f } from "lit/directives/class-map.js";
|
|
4
|
+
class E {
|
|
5
|
+
constructor(r, e) {
|
|
6
|
+
r.addController(this), this.getTargets = e.getTargets, this.getState = e.getState;
|
|
7
|
+
}
|
|
8
|
+
hostConnected() {
|
|
9
|
+
}
|
|
10
|
+
hostUpdated() {
|
|
11
|
+
const r = this.getTargets();
|
|
12
|
+
if (!r) return;
|
|
13
|
+
let e = [];
|
|
14
|
+
r instanceof NodeList ? e = Array.from(r) : Array.isArray(r) ? e = r : e = [r];
|
|
15
|
+
const { uid: l, templateData: n } = this.getState(), { touched: _, errors: c, readonly: v, disabled: A, hint: y, required: q } = n, d = _ && c && c.length > 0;
|
|
16
|
+
C(
|
|
17
|
+
e,
|
|
18
|
+
(t) => !!t,
|
|
19
|
+
(t) => {
|
|
20
|
+
const a = ($, u) => {
|
|
21
|
+
u ? t.setAttribute($, u) : t.removeAttribute($);
|
|
22
|
+
};
|
|
23
|
+
a("aria-describedby", y ? `${l}_hint` : null), a("aria-invalid", d ? "true" : null), a("aria-errormessage", d ? `${l}_errors` : null), a("aria-readonly", v ? "true" : null), a("aria-disabled", A ? "true" : null), a("aria-required", q ? "true" : null);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const g = (s) => s ? i`<span aria-hidden="true"> *</span>` : o, G = (s, r, e = !1, l = void 0, n = !0) => n ? r.label ? i`<label
|
|
29
|
+
class="gui-label"
|
|
30
|
+
for=${s}
|
|
31
|
+
data-cy=${`${s}_label`}
|
|
32
|
+
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
33
|
+
>
|
|
34
|
+
${r.label}${g(r.required)}
|
|
35
|
+
${h(s, r)} ${e ? b(s, r) : o}
|
|
36
|
+
</label>` : o : r.label ? i`<span
|
|
37
|
+
class="gui-label"
|
|
38
|
+
data-cy=${`${s}_label`}
|
|
39
|
+
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
40
|
+
>
|
|
41
|
+
${r.label}${g(r.required)}
|
|
42
|
+
${h(s, r)} ${e ? b(s, r) : o}
|
|
43
|
+
</span>` : o, h = (s, r) => r.hint ? i`<div class="gui-widget-hint" id=${`${s}_hint`}>${r.hint}</div>` : i``, I = (s, r) => {
|
|
44
|
+
const e = {
|
|
45
|
+
[`gui-${s}--icon`]: !1,
|
|
46
|
+
[`gui-${s}--icon-right`]: !1
|
|
47
|
+
};
|
|
48
|
+
if (r.icon) {
|
|
49
|
+
e[`gui-${s}--icon`] = !0;
|
|
50
|
+
const l = {
|
|
51
|
+
"gui-widget-icon": !0,
|
|
52
|
+
[r.icon]: !0
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
widgetClasses: e,
|
|
56
|
+
html: i`<span
|
|
57
|
+
class=${f(l)}
|
|
58
|
+
data-icon=${r.icon}
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
></span>`
|
|
61
|
+
};
|
|
62
|
+
} else
|
|
63
|
+
return { widgetClasses: e, html: i`` };
|
|
64
|
+
}, b = (s, r) => {
|
|
65
|
+
const e = r.touched && r.errors && r.errors.length > 0;
|
|
66
|
+
return i`<ul
|
|
67
|
+
class=${f({
|
|
68
|
+
"gui-validator": !0,
|
|
69
|
+
"gui-validator--empty": !e
|
|
70
|
+
})}
|
|
71
|
+
id=${`${s}_errors`}
|
|
72
|
+
role="alert"
|
|
73
|
+
data-cy=${e ? `${s}_validator-errors` : o}
|
|
74
|
+
>
|
|
75
|
+
${e ? r.errors?.map(
|
|
76
|
+
(n) => i`<li class="gui-validator__error" data-cy=${`${s}_validator-error`}>
|
|
77
|
+
${n}
|
|
78
|
+
</li>`
|
|
79
|
+
) : o}
|
|
80
|
+
</ul>`;
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
E as G,
|
|
84
|
+
I as a,
|
|
85
|
+
G as b,
|
|
86
|
+
b as c,
|
|
87
|
+
g as r
|
|
88
|
+
};
|
|
@@ -2,12 +2,12 @@ import { InputWidgetAdapter as v, formContext as b, inputContext as $ } from "@g
|
|
|
2
2
|
import { LitElement as m, html as n, nothing as c } from "lit";
|
|
3
3
|
import { property as i, customElement as g } from "lit/decorators.js";
|
|
4
4
|
import { classMap as x } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as f, b as C, c as w } from "./templates-
|
|
5
|
+
import { G as f, b as C, c as w } from "./templates-Dmr34nwp.js";
|
|
6
6
|
import { styleMap as D } from "lit-html/directives/style-map.js";
|
|
7
7
|
import { consume as _, provide as L } from "@lit/context";
|
|
8
8
|
import "rxjs";
|
|
9
|
-
var S = Object.defineProperty,
|
|
10
|
-
for (var e = s > 1 ? void 0 : s ?
|
|
9
|
+
var S = Object.defineProperty, q = Object.getOwnPropertyDescriptor, o = (t, a, d, s) => {
|
|
10
|
+
for (var e = s > 1 ? void 0 : s ? q(a, d) : a, l = t.length - 1, p; l >= 0; l--)
|
|
11
11
|
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
12
12
|
return s && e && S(a, d, e), e;
|
|
13
13
|
};
|
|
@@ -22,7 +22,8 @@ let r = class extends m {
|
|
|
22
22
|
errors: this.errors,
|
|
23
23
|
readonly: this.readOnly,
|
|
24
24
|
disabled: this.disabled,
|
|
25
|
-
touched: this.touched
|
|
25
|
+
touched: this.touched,
|
|
26
|
+
required: this.required
|
|
26
27
|
}
|
|
27
28
|
})
|
|
28
29
|
});
|
|
@@ -170,10 +171,10 @@ r = o([
|
|
|
170
171
|
g("gui-textarea")
|
|
171
172
|
], r);
|
|
172
173
|
typeof customElements < "u" && !customElements.get("gui-textarea") && customElements.define("gui-textarea", r);
|
|
173
|
-
var
|
|
174
|
-
for (var e = s > 1 ? void 0 : s ?
|
|
174
|
+
var O = Object.defineProperty, E = Object.getOwnPropertyDescriptor, h = (t, a, d, s) => {
|
|
175
|
+
for (var e = s > 1 ? void 0 : s ? E(a, d) : a, l = t.length - 1, p; l >= 0; l--)
|
|
175
176
|
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
176
|
-
return s && e &&
|
|
177
|
+
return s && e && O(a, d, e), e;
|
|
177
178
|
};
|
|
178
179
|
let u = class extends m {
|
|
179
180
|
constructor() {
|
|
@@ -2,13 +2,13 @@ import { InputWidgetAdapter as b, formContext as v, inputContext as g } from "@g
|
|
|
2
2
|
import { LitElement as c, nothing as h, html as m } from "lit";
|
|
3
3
|
import { property as r, customElement as y } from "lit/decorators.js";
|
|
4
4
|
import { classMap as f } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as $, a as x, b as C, c as D } from "./templates-
|
|
5
|
+
import { G as $, a as x, b as C, c as D } from "./templates-Dmr34nwp.js";
|
|
6
6
|
import { consume as O, provide as _ } from "@lit/context";
|
|
7
7
|
import "rxjs";
|
|
8
|
-
var
|
|
9
|
-
for (var a = l > 1 ? void 0 : l ?
|
|
8
|
+
var q = Object.defineProperty, w = Object.getOwnPropertyDescriptor, s = (t, e, o, l) => {
|
|
9
|
+
for (var a = l > 1 ? void 0 : l ? w(e, o) : e, p = t.length - 1, d; p >= 0; p--)
|
|
10
10
|
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
11
|
-
return l && a &&
|
|
11
|
+
return l && a && q(e, o, a), a;
|
|
12
12
|
};
|
|
13
13
|
let i = class extends c {
|
|
14
14
|
constructor() {
|
|
@@ -21,7 +21,8 @@ let i = class extends c {
|
|
|
21
21
|
errors: this.errors,
|
|
22
22
|
readonly: this.readOnly,
|
|
23
23
|
disabled: this.disabled,
|
|
24
|
-
touched: this.touched
|
|
24
|
+
touched: this.touched,
|
|
25
|
+
required: this.required
|
|
25
26
|
}
|
|
26
27
|
})
|
|
27
28
|
});
|
|
@@ -61,7 +62,7 @@ let i = class extends c {
|
|
|
61
62
|
data-cy=${`${this.uid}_textinput`}
|
|
62
63
|
class=${f(o)}
|
|
63
64
|
value=${this.value}
|
|
64
|
-
?required=${this.
|
|
65
|
+
?required=${this.required}
|
|
65
66
|
?disabled=${this.disabled}
|
|
66
67
|
?readonly=${this.readOnly}
|
|
67
68
|
placeholder=${this.placeholder || h}
|
|
@@ -139,10 +140,10 @@ i = s([
|
|
|
139
140
|
y("gui-textinput")
|
|
140
141
|
], i);
|
|
141
142
|
typeof customElements < "u" && !customElements.get("gui-textinput") && customElements.define("gui-textinput", i);
|
|
142
|
-
var
|
|
143
|
-
for (var a = l > 1 ? void 0 : l ?
|
|
143
|
+
var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, u = (t, e, o, l) => {
|
|
144
|
+
for (var a = l > 1 ? void 0 : l ? S(e, o) : e, p = t.length - 1, d; p >= 0; p--)
|
|
144
145
|
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
145
|
-
return l && a &&
|
|
146
|
+
return l && a && E(e, o, a), a;
|
|
146
147
|
};
|
|
147
148
|
let n = class extends c {
|
|
148
149
|
constructor() {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as
|
|
1
|
+
import { LitElement as p, nothing as n, html as d } from "lit";
|
|
2
|
+
import { property as i, customElement as m } from "lit/decorators.js";
|
|
3
3
|
import { classMap as c } from "lit/directives/class-map.js";
|
|
4
|
-
import { G as g, b as y, c as
|
|
5
|
-
import { G as
|
|
6
|
-
var
|
|
7
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
8
|
-
(
|
|
9
|
-
return r && a &&
|
|
4
|
+
import { G as g, b as y, c as b } from "./templates-Dmr34nwp.js";
|
|
5
|
+
import { G as v, g as f, u as L, r as E, v as D, w as T, P as A } from "./part-templates-VORbpgs2.js";
|
|
6
|
+
var S = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (s, o, l, r) => {
|
|
7
|
+
for (var a = r > 1 ? void 0 : r ? P(o, l) : o, u = s.length - 1, h; u >= 0; u--)
|
|
8
|
+
(h = s[u]) && (a = (r ? h(o, l, a) : h(a)) || a);
|
|
9
|
+
return r && a && S(o, l, a), a;
|
|
10
10
|
};
|
|
11
|
-
let t = class extends
|
|
11
|
+
let t = class extends p {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.minTime = void 0, this.maxTime = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.inputBlockClass = "gui-time-input", this.groups = ["default"], this._parts = new
|
|
13
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.minTime = void 0, this.maxTime = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.inputBlockClass = "gui-time-input", this.groups = ["default"], this._parts = new v(this, {
|
|
14
14
|
blockClass: this.inputBlockClass,
|
|
15
15
|
groups: this.groups,
|
|
16
|
-
getDescriptor: (
|
|
17
|
-
commitGroup: (
|
|
16
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
17
|
+
commitGroup: (s) => this.validateAndEmit(s),
|
|
18
18
|
isReadonly: () => !!this.readOnly,
|
|
19
19
|
isDisabled: () => !!this.disabled,
|
|
20
20
|
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 })),
|
|
@@ -29,7 +29,8 @@ let t = class extends d {
|
|
|
29
29
|
errors: this.errors,
|
|
30
30
|
readonly: this.readOnly,
|
|
31
31
|
disabled: this.disabled,
|
|
32
|
-
touched: this.touched
|
|
32
|
+
touched: this.touched,
|
|
33
|
+
required: this.required
|
|
33
34
|
}
|
|
34
35
|
})
|
|
35
36
|
});
|
|
@@ -43,11 +44,11 @@ let t = class extends d {
|
|
|
43
44
|
get timeLocaleData() {
|
|
44
45
|
return f(this.localeId, this.hourFormat, this.minuteStep);
|
|
45
46
|
}
|
|
46
|
-
getPartDescriptor(
|
|
47
|
-
return this.timeLocaleData.descriptors[
|
|
47
|
+
getPartDescriptor(s) {
|
|
48
|
+
return this.timeLocaleData.descriptors[s];
|
|
48
49
|
}
|
|
49
|
-
willUpdate(
|
|
50
|
-
(!this.hasUpdated ||
|
|
50
|
+
willUpdate(s) {
|
|
51
|
+
(!this.hasUpdated || s.has("value") || s.has("hourFormat") || s.has("localeId")) && this._parts.setGroupFromISO(
|
|
51
52
|
"default",
|
|
52
53
|
this.value ?? "",
|
|
53
54
|
"time",
|
|
@@ -55,7 +56,7 @@ let t = class extends d {
|
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
render() {
|
|
58
|
-
const
|
|
59
|
+
const s = {
|
|
59
60
|
uid: this.uid,
|
|
60
61
|
label: this.label,
|
|
61
62
|
errors: this.errors,
|
|
@@ -69,42 +70,52 @@ let t = class extends d {
|
|
|
69
70
|
}, o = {
|
|
70
71
|
blockClass: this.inputBlockClass,
|
|
71
72
|
groups: this.groups,
|
|
72
|
-
formatParts:
|
|
73
|
+
formatParts: L(this.localeId, this.timeLocaleData.effectiveHourFormat),
|
|
73
74
|
getDescriptor: (r) => this.getPartDescriptor(r),
|
|
74
75
|
getDisplayValue: this._parts.getPartDisplay,
|
|
75
|
-
|
|
76
|
+
getPartAriaLabel: (r, a) => ({
|
|
77
|
+
hour: this.hourAriaLabel,
|
|
78
|
+
minute: this.minuteAriaLabel
|
|
79
|
+
})[a] ?? A[a],
|
|
80
|
+
dayPeriodAriaLabel: this.dayPeriodAriaLabel,
|
|
76
81
|
disabled: this.disabled,
|
|
77
82
|
partsReadonly: !!this.readOnly
|
|
78
83
|
}, l = {
|
|
79
84
|
"gui-widget-icon": !0,
|
|
80
85
|
[this.icon]: !0
|
|
81
86
|
};
|
|
82
|
-
return
|
|
83
|
-
${this.label ? y(this.uid,
|
|
87
|
+
return d`
|
|
88
|
+
${this.label ? y(this.uid, s, !1, void 0, !1) : n}
|
|
84
89
|
|
|
85
90
|
<div class="gui-widget">
|
|
86
91
|
<div
|
|
92
|
+
id=${this.uid}
|
|
87
93
|
class="gui-widget-input gui-parts gui-parts-ring gui-time-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
88
94
|
role="group"
|
|
95
|
+
aria-labelledby=${`${this.uid}_label`}
|
|
89
96
|
>
|
|
90
|
-
${
|
|
97
|
+
${E("default", o, this._parts)}
|
|
91
98
|
</div>
|
|
92
|
-
${this.icon ?
|
|
99
|
+
${this.icon ? d`<span
|
|
100
|
+
class=${c(l)}
|
|
101
|
+
data-icon=${this.icon}
|
|
102
|
+
aria-hidden="true"
|
|
103
|
+
></span>` : n}
|
|
93
104
|
</div>
|
|
94
105
|
|
|
95
|
-
${this.showErrors && this.errors?.length ?
|
|
106
|
+
${this.showErrors && this.errors?.length ? b(this.uid, s) : n}
|
|
96
107
|
`;
|
|
97
108
|
}
|
|
98
|
-
validateAndEmit(
|
|
99
|
-
const { effectiveHourFormat: o, descriptors: l } = this.timeLocaleData, { result: r, writeBacks: a } =
|
|
109
|
+
validateAndEmit(s) {
|
|
110
|
+
const { effectiveHourFormat: o, descriptors: l } = this.timeLocaleData, { result: r, writeBacks: a } = D(this._parts.values[s] ?? {}, {
|
|
100
111
|
hourFormat: o,
|
|
101
112
|
descriptors: l
|
|
102
113
|
});
|
|
103
|
-
if (this._parts.applyWriteBacks(
|
|
114
|
+
if (this._parts.applyWriteBacks(s, a), r.kind !== "valid") {
|
|
104
115
|
this.requestUpdate();
|
|
105
116
|
return;
|
|
106
117
|
}
|
|
107
|
-
const u =
|
|
118
|
+
const u = T(r.iso, {
|
|
108
119
|
minTime: this.minTime,
|
|
109
120
|
maxTime: this.maxTime,
|
|
110
121
|
minTimeMessage: this.minTimeMessage,
|
|
@@ -122,58 +133,67 @@ let t = class extends d {
|
|
|
122
133
|
}
|
|
123
134
|
};
|
|
124
135
|
e([
|
|
125
|
-
|
|
136
|
+
i({ type: String })
|
|
126
137
|
], t.prototype, "uid", 2);
|
|
127
138
|
e([
|
|
128
|
-
|
|
139
|
+
i({ type: String })
|
|
129
140
|
], t.prototype, "label", 2);
|
|
130
141
|
e([
|
|
131
|
-
|
|
142
|
+
i({ type: String, attribute: "locale-id" })
|
|
132
143
|
], t.prototype, "localeId", 2);
|
|
133
144
|
e([
|
|
134
|
-
|
|
145
|
+
i({ type: Array })
|
|
135
146
|
], t.prototype, "errors", 2);
|
|
136
147
|
e([
|
|
137
|
-
|
|
148
|
+
i({ type: Boolean })
|
|
138
149
|
], t.prototype, "showErrors", 2);
|
|
139
150
|
e([
|
|
140
|
-
|
|
151
|
+
i({ type: Boolean })
|
|
141
152
|
], t.prototype, "touched", 2);
|
|
142
153
|
e([
|
|
143
|
-
|
|
154
|
+
i({ type: Boolean })
|
|
144
155
|
], t.prototype, "required", 2);
|
|
145
156
|
e([
|
|
146
|
-
|
|
157
|
+
i({ type: Boolean })
|
|
147
158
|
], t.prototype, "disabled", 2);
|
|
148
159
|
e([
|
|
149
|
-
|
|
160
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
150
161
|
], t.prototype, "readOnly", 2);
|
|
151
162
|
e([
|
|
152
|
-
|
|
163
|
+
i({ type: String })
|
|
153
164
|
], t.prototype, "icon", 2);
|
|
154
165
|
e([
|
|
155
|
-
|
|
166
|
+
i({ type: String })
|
|
156
167
|
], t.prototype, "hint", 2);
|
|
157
168
|
e([
|
|
158
|
-
|
|
169
|
+
i({ type: String })
|
|
170
|
+
], t.prototype, "hourAriaLabel", 2);
|
|
171
|
+
e([
|
|
172
|
+
i({ type: String })
|
|
173
|
+
], t.prototype, "minuteAriaLabel", 2);
|
|
174
|
+
e([
|
|
175
|
+
i({ type: String })
|
|
176
|
+
], t.prototype, "dayPeriodAriaLabel", 2);
|
|
177
|
+
e([
|
|
178
|
+
i({ type: String })
|
|
159
179
|
], t.prototype, "value", 2);
|
|
160
180
|
e([
|
|
161
|
-
|
|
181
|
+
i({ type: String, attribute: "hour-format" })
|
|
162
182
|
], t.prototype, "hourFormat", 2);
|
|
163
183
|
e([
|
|
164
|
-
|
|
184
|
+
i({ type: Number, attribute: "minute-step" })
|
|
165
185
|
], t.prototype, "minuteStep", 2);
|
|
166
186
|
e([
|
|
167
|
-
|
|
187
|
+
i({ type: String, attribute: "min-time" })
|
|
168
188
|
], t.prototype, "minTime", 2);
|
|
169
189
|
e([
|
|
170
|
-
|
|
190
|
+
i({ type: String, attribute: "max-time" })
|
|
171
191
|
], t.prototype, "maxTime", 2);
|
|
172
192
|
e([
|
|
173
|
-
|
|
193
|
+
i({ type: String, attribute: "min-time-message" })
|
|
174
194
|
], t.prototype, "minTimeMessage", 2);
|
|
175
195
|
e([
|
|
176
|
-
|
|
196
|
+
i({ type: String, attribute: "max-time-message" })
|
|
177
197
|
], t.prototype, "maxTimeMessage", 2);
|
|
178
198
|
t = e([
|
|
179
199
|
m("gui-time")
|
|
@@ -2,7 +2,7 @@ import { LitElement as v, html as p, nothing as b } from "lit";
|
|
|
2
2
|
import { property as l, customElement as _ } from "lit/decorators.js";
|
|
3
3
|
import { classMap as S } from "lit/directives/class-map.js";
|
|
4
4
|
import { g as O, l as x, n as f, c as T } from "./focus-leave.controller-2gV0pQd5.js";
|
|
5
|
-
import { e as $, A as w, l as I, s as E, N as R } from "./part-templates-
|
|
5
|
+
import { e as $, A as w, l as I, s as E, N as R } from "./part-templates-VORbpgs2.js";
|
|
6
6
|
var A = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (t, e, i, o) => {
|
|
7
7
|
for (var n = o > 1 ? void 0 : o ? C(e, i) : e, a = t.length - 1, u; a >= 0; a--)
|
|
8
8
|
(u = t[a]) && (n = (o ? u(e, i, n) : u(n)) || n);
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as s, query as
|
|
1
|
+
import { LitElement as h, html as u } from "lit";
|
|
2
|
+
import { property as s, query as m, customElement as d } from "lit/decorators.js";
|
|
3
3
|
import { classMap as g } from "lit/directives/class-map.js";
|
|
4
|
-
import "./time-input-
|
|
5
|
-
import "./time-list-
|
|
6
|
-
import { G as c } from "./popup.controller-
|
|
7
|
-
import { h as y, A as
|
|
8
|
-
import { a as
|
|
9
|
-
import {
|
|
10
|
-
var
|
|
11
|
-
for (var l =
|
|
12
|
-
(
|
|
13
|
-
return
|
|
4
|
+
import "./time-input-5dkSm8UW.js";
|
|
5
|
+
import "./time-list-DLcq8BAp.js";
|
|
6
|
+
import { G as c } from "./popup.controller-B33OvX_y.js";
|
|
7
|
+
import { w as b, h as y, A as v } from "./part-templates-VORbpgs2.js";
|
|
8
|
+
import { a as T, b as f, c as $ } from "./templates-Dmr34nwp.js";
|
|
9
|
+
import { e as w } from "./date-DBuYpvcO.js";
|
|
10
|
+
var _ = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (e, o, r, a) => {
|
|
11
|
+
for (var l = a > 1 ? void 0 : a ? A(o, r) : o, p = e.length - 1, n; p >= 0; p--)
|
|
12
|
+
(n = e[p]) && (l = (a ? n(o, r, l) : n(l)) || l);
|
|
13
|
+
return a && l && _(o, r, l), l;
|
|
14
14
|
};
|
|
15
|
-
let t = class extends
|
|
15
|
+
let t = class extends h {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.localeId = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.minTime = void 0, this.maxTime = void 0, this.disabledRanges = void 0, this.allowCustomTime = !1, this.height = void 0, this.itemHeight = void 0, this.columns = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.disabledRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this._popup = new c(this, {
|
|
18
|
-
getInteriorElements: () => [this._timeRef, this._listRef],
|
|
17
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.toggleAriaLabel = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.localeId = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.minTime = void 0, this.maxTime = void 0, this.disabledRanges = void 0, this.allowCustomTime = !1, this.height = void 0, this.itemHeight = void 0, this.columns = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.disabledRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this._popup = new c(this, {
|
|
19
18
|
focusRestoreSelector: "gui-time input, gui-time button",
|
|
19
|
+
focusPopupSelector: '.gui-time-list__option[tabindex="0"]',
|
|
20
20
|
isDisabled: () => !!this.disabled,
|
|
21
21
|
clickIntent: (e) => e.closest(".gui-time-list__option") ? "ignore" : e.closest("gui-time") || e.closest("gui-time-list") ? "open" : "toggle",
|
|
22
22
|
keyToggleMode: "openClose",
|
|
23
23
|
onOpenChanged: (e) => {
|
|
24
24
|
this.dispatchListToggle(e), e && this.updateComplete.then(() => this._listRef?.scrollToSelectedValue());
|
|
25
25
|
}
|
|
26
|
-
}), this.
|
|
26
|
+
}), this.onToggleClick = (e) => {
|
|
27
|
+
e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
|
|
28
|
+
}, this.onKeyDown = (e) => {
|
|
27
29
|
if (this._popup.onAnchorKeyDown(e)) return;
|
|
28
30
|
if (e.key === "Enter" && e.target.closest("gui-time")) {
|
|
29
31
|
this._popup.open && this._popup.close(), this.commitValue(this.value, !0);
|
|
@@ -39,23 +41,21 @@ let t = class extends u {
|
|
|
39
41
|
e.has("value") && this._listRef && this._listRef.value !== this.value && (this._listRef.value = this.value);
|
|
40
42
|
}
|
|
41
43
|
render() {
|
|
42
|
-
const e =
|
|
43
|
-
return
|
|
44
|
-
${f(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const e = T("timePicker", { icon: this.icon });
|
|
45
|
+
return u`
|
|
46
|
+
${f(
|
|
47
|
+
this.uid ?? "",
|
|
48
|
+
{
|
|
49
|
+
label: this.label,
|
|
50
|
+
hint: this.hint,
|
|
51
|
+
required: this.required
|
|
52
|
+
},
|
|
53
|
+
!1,
|
|
54
|
+
void 0,
|
|
55
|
+
!1
|
|
56
|
+
)}
|
|
49
57
|
|
|
50
|
-
<div
|
|
51
|
-
role="button"
|
|
52
|
-
tabindex="-1"
|
|
53
|
-
class="gui-widget"
|
|
54
|
-
aria-expanded=${this._popup.open}
|
|
55
|
-
@keyup=${this._popup.onAnchorKeyUp}
|
|
56
|
-
@keydown=${this.onKeyDown}
|
|
57
|
-
@click=${this._popup.onAnchorClick}
|
|
58
|
-
>
|
|
58
|
+
<div class="gui-widget" @keydown=${this.onKeyDown} @click=${this._popup.onAnchorClick}>
|
|
59
59
|
<gui-time
|
|
60
60
|
id="time-input"
|
|
61
61
|
class=${g(e.widgetClasses)}
|
|
@@ -74,20 +74,42 @@ let t = class extends u {
|
|
|
74
74
|
.minuteStep=${this.minuteStep}
|
|
75
75
|
.minTime=${this.minTime}
|
|
76
76
|
.maxTime=${this.maxTime}
|
|
77
|
+
.hourAriaLabel=${this.hourAriaLabel}
|
|
78
|
+
.minuteAriaLabel=${this.minuteAriaLabel}
|
|
79
|
+
.dayPeriodAriaLabel=${this.dayPeriodAriaLabel}
|
|
77
80
|
.minTimeMessage=${this.minTimeMessage}
|
|
78
81
|
.maxTimeMessage=${this.maxTimeMessage}
|
|
79
82
|
@blur=${this.onTimeBlur}
|
|
80
83
|
@focus=${this._popup.show}
|
|
81
84
|
@change=${this.onTimeChange}
|
|
82
85
|
></gui-time>
|
|
83
|
-
<
|
|
84
|
-
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
class="gui-time-picker__arrow"
|
|
89
|
+
aria-label=${this.toggleAriaLabel ?? "Show time list"}
|
|
90
|
+
aria-haspopup="dialog"
|
|
91
|
+
aria-expanded=${this._popup.open ? "true" : "false"}
|
|
92
|
+
aria-controls=${`${this.uid}_popup`}
|
|
93
|
+
?disabled=${this.disabled}
|
|
94
|
+
@click=${this.onToggleClick}
|
|
95
|
+
>
|
|
96
|
+
<svg
|
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
+
width="16"
|
|
99
|
+
height="16"
|
|
100
|
+
viewBox="0 0 256 256"
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
>
|
|
85
103
|
<path
|
|
86
104
|
d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
|
|
87
|
-
></path
|
|
88
|
-
|
|
105
|
+
></path>
|
|
106
|
+
</svg>
|
|
107
|
+
</button>
|
|
89
108
|
|
|
90
109
|
<gui-time-list
|
|
110
|
+
id=${`${this.uid}_popup`}
|
|
111
|
+
role="dialog"
|
|
112
|
+
aria-label=${this.label ?? "Time list"}
|
|
91
113
|
.uid=${this.uid}
|
|
92
114
|
.value=${this.value}
|
|
93
115
|
.label=${this.label}
|
|
@@ -107,7 +129,7 @@ let t = class extends u {
|
|
|
107
129
|
></gui-time-list>
|
|
108
130
|
</div>
|
|
109
131
|
|
|
110
|
-
${this.showErrors ?
|
|
132
|
+
${this.showErrors ? $(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
111
133
|
`;
|
|
112
134
|
}
|
|
113
135
|
onTimeChange(e) {
|
|
@@ -127,37 +149,44 @@ let t = class extends u {
|
|
|
127
149
|
*/
|
|
128
150
|
commitValue(e, o = !1) {
|
|
129
151
|
this.value = e ?? void 0;
|
|
130
|
-
const
|
|
152
|
+
const r = this.validateBounds(this.value);
|
|
131
153
|
this.dispatchEvent(
|
|
132
154
|
new CustomEvent("change", {
|
|
133
155
|
detail: { value: e ?? null, commit: o },
|
|
134
156
|
bubbles: !0,
|
|
135
157
|
composed: !0
|
|
136
158
|
})
|
|
137
|
-
),
|
|
159
|
+
), r && this.dispatchEvent(
|
|
138
160
|
new CustomEvent("inputError", {
|
|
139
|
-
detail: { message:
|
|
161
|
+
detail: { message: r },
|
|
140
162
|
bubbles: !0,
|
|
141
163
|
composed: !0
|
|
142
164
|
})
|
|
143
165
|
);
|
|
144
166
|
}
|
|
145
167
|
validateBounds(e) {
|
|
146
|
-
|
|
168
|
+
if (!e) return null;
|
|
169
|
+
const o = b(e, {
|
|
170
|
+
minTime: this.minTime,
|
|
171
|
+
maxTime: this.maxTime,
|
|
172
|
+
minTimeMessage: this.minTimeMessage,
|
|
173
|
+
maxTimeMessage: this.maxTimeMessage
|
|
174
|
+
});
|
|
175
|
+
return o || (y(e, this.disabledRanges) ? this.disabledRangeMessage ?? w : null);
|
|
147
176
|
}
|
|
148
177
|
selectAdjacentOption(e) {
|
|
149
|
-
const o =
|
|
178
|
+
const o = v({
|
|
150
179
|
minTime: this.minTime,
|
|
151
180
|
maxTime: this.maxTime,
|
|
152
181
|
minuteStep: this.minuteStep,
|
|
153
182
|
disabledRanges: this.disabledRanges
|
|
154
183
|
});
|
|
155
184
|
if (!o.length) return;
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
for (;
|
|
159
|
-
|
|
160
|
-
|
|
185
|
+
const r = o.findIndex((l) => l.value === this.value);
|
|
186
|
+
let a = r === -1 ? e === 1 ? 0 : o.length - 1 : r + e;
|
|
187
|
+
for (; a >= 0 && a < o.length && o[a].disabled; )
|
|
188
|
+
a += e;
|
|
189
|
+
a < 0 || a >= o.length || (this.commitValue(o[a].value), this._popup.show(), this.updateComplete.then(() => this._listRef?.scrollToSelectedValue()));
|
|
161
190
|
}
|
|
162
191
|
/** Public close hook kept for the date-time calendars, which close the
|
|
163
192
|
* embedded time-picker's list imperatively. */
|
|
@@ -186,6 +215,18 @@ i([
|
|
|
186
215
|
i([
|
|
187
216
|
s({ type: String })
|
|
188
217
|
], t.prototype, "icon", 2);
|
|
218
|
+
i([
|
|
219
|
+
s({ type: String, attribute: "toggle-aria-label" })
|
|
220
|
+
], t.prototype, "toggleAriaLabel", 2);
|
|
221
|
+
i([
|
|
222
|
+
s({ type: String })
|
|
223
|
+
], t.prototype, "hourAriaLabel", 2);
|
|
224
|
+
i([
|
|
225
|
+
s({ type: String })
|
|
226
|
+
], t.prototype, "minuteAriaLabel", 2);
|
|
227
|
+
i([
|
|
228
|
+
s({ type: String })
|
|
229
|
+
], t.prototype, "dayPeriodAriaLabel", 2);
|
|
189
230
|
i([
|
|
190
231
|
s({ type: Array })
|
|
191
232
|
], t.prototype, "errors", 2);
|
|
@@ -250,10 +291,7 @@ i([
|
|
|
250
291
|
s({ type: String, attribute: "no-available-times-message" })
|
|
251
292
|
], t.prototype, "noAvailableTimesMessage", 2);
|
|
252
293
|
i([
|
|
253
|
-
|
|
254
|
-
], t.prototype, "_timeRef", 2);
|
|
255
|
-
i([
|
|
256
|
-
p("gui-time-list")
|
|
294
|
+
m("gui-time-list")
|
|
257
295
|
], t.prototype, "_listRef", 2);
|
|
258
296
|
t = i([
|
|
259
297
|
d("gui-time-picker")
|