@golemui/gui-lit 1.0.3 → 1.1.1-rc.0
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 +26 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/calendar-D31xNsxx.js +267 -0
- package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
- package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
- package/date-input-DLiMreSS.js +204 -0
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/date-time-calendar-DzU-FtVl.js +374 -0
- package/date-time-calendar.element-BLBcVsFu.js +95 -0
- package/date-time-input-DZaz2heD.js +246 -0
- package/date-time-picker.element-BUbLdV6i.js +440 -0
- package/date-time.element-B5onfSBG.js +93 -0
- package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
- package/day-status-CsWStVQV.js +554 -0
- package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1635 -948
- package/index.umd.cjs +2046 -601
- package/lib/components/date-picker.element.d.ts +0 -11
- package/lib/components/date-time-calendar.element.d.ts +18 -0
- package/lib/components/date-time-picker.element.d.ts +18 -0
- package/lib/components/date-time.element.d.ts +18 -0
- package/lib/components/dropdown.element.d.ts +2 -0
- package/lib/components/range-calendar.element.d.ts +2 -1
- package/lib/components/range-date-picker.element.d.ts +0 -15
- package/lib/components/range-date-time-calendar.element.d.ts +18 -0
- package/lib/components/range-date-time-input.element.d.ts +18 -0
- package/lib/components/range-date-time-picker.element.d.ts +18 -0
- package/lib/components/range-time-input.element.d.ts +18 -0
- package/lib/components/range-time-picker.element.d.ts +18 -0
- package/lib/components/time-picker.element.d.ts +18 -0
- package/lib/components/time.element.d.ts +18 -0
- package/list-D730tmGN.js +297 -0
- package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
- 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 +6 -6
- package/part-templates-VORbpgs2.js +691 -0
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/pill-ranges-DpvWwP-3.js +48 -0
- package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/range-calendar-DO_woqcF.js +466 -0
- package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
- package/range-commit-8-MmYUyo.js +14 -0
- package/range-date-input-Br7XqQPK.js +311 -0
- package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
- package/range-date-picker.element-DWRHiAoC.js +434 -0
- package/range-date-time-calendar-B3EMgN1E.js +734 -0
- package/range-date-time-calendar.element-Coea6RF4.js +97 -0
- package/range-date-time-input-Cu-T_nuC.js +353 -0
- package/range-date-time-input.element-Cti44iuW.js +87 -0
- package/range-date-time-picker.element-CDN2RL1y.js +472 -0
- package/range-selection-CU3hxLJE.js +25 -0
- package/range-time-input-BP9ZL9O8.js +348 -0
- package/range-time-input.element-B7wtHJoQ.js +84 -0
- package/range-time-picker.element-CPIAiQPC.js +470 -0
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-CX3vQL8L.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-5dkSm8UW.js +201 -0
- package/time-list-DLcq8BAp.js +217 -0
- package/time-picker-g337F8d0.js +299 -0
- package/time-picker.element-DLihegjg.js +89 -0
- package/time.element-BneqgMlQ.js +85 -0
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- package/abstract-calendar-D0-077XJ.js +0 -545
- package/calendar-BclCC9VJ.js +0 -96
- package/date-input-DCdGWRio.js +0 -268
- package/date-picker.element-k7AJFQ5W.js +0 -168
- package/list-D1oKnH89.js +0 -283
- package/range-calendar-CBINu84w.js +0 -255
- package/range-date-input-BYXzqnr1.js +0 -395
- package/range-date-picker.element-BCBefgvY.js +0 -182
- package/templates-Dk1jxLwS.js +0 -75
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
import { classMap as c } from "lit/directives/class-map.js";
|
|
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
|
+
};
|
|
11
|
+
let t = class extends p {
|
|
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.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
|
+
blockClass: this.inputBlockClass,
|
|
15
|
+
groups: this.groups,
|
|
16
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
17
|
+
commitGroup: (s) => this.validateAndEmit(s),
|
|
18
|
+
isReadonly: () => !!this.readOnly,
|
|
19
|
+
isDisabled: () => !!this.disabled,
|
|
20
|
+
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 })),
|
|
21
|
+
getHourFormat: () => this.timeLocaleData.effectiveHourFormat,
|
|
22
|
+
getDayPeriodLabels: () => this.timeLocaleData.dayPeriodLabels
|
|
23
|
+
}), this.ariaController = new g(this, {
|
|
24
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
25
|
+
getState: () => ({
|
|
26
|
+
uid: this.uid,
|
|
27
|
+
templateData: {
|
|
28
|
+
hint: this.hint,
|
|
29
|
+
errors: this.errors,
|
|
30
|
+
readonly: this.readOnly,
|
|
31
|
+
disabled: this.disabled,
|
|
32
|
+
touched: this.touched,
|
|
33
|
+
required: this.required
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
createRenderRoot() {
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
43
|
+
}
|
|
44
|
+
get timeLocaleData() {
|
|
45
|
+
return f(this.localeId, this.hourFormat, this.minuteStep);
|
|
46
|
+
}
|
|
47
|
+
getPartDescriptor(s) {
|
|
48
|
+
return this.timeLocaleData.descriptors[s];
|
|
49
|
+
}
|
|
50
|
+
willUpdate(s) {
|
|
51
|
+
(!this.hasUpdated || s.has("value") || s.has("hourFormat") || s.has("localeId")) && this._parts.setGroupFromISO(
|
|
52
|
+
"default",
|
|
53
|
+
this.value ?? "",
|
|
54
|
+
"time",
|
|
55
|
+
this.timeLocaleData.effectiveHourFormat
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
const s = {
|
|
60
|
+
uid: this.uid,
|
|
61
|
+
label: this.label,
|
|
62
|
+
errors: this.errors,
|
|
63
|
+
touched: this.touched,
|
|
64
|
+
required: this.required,
|
|
65
|
+
disabled: this.disabled,
|
|
66
|
+
readonly: this.readOnly,
|
|
67
|
+
value: this.value,
|
|
68
|
+
icon: this.icon,
|
|
69
|
+
hint: this.hint
|
|
70
|
+
}, o = {
|
|
71
|
+
blockClass: this.inputBlockClass,
|
|
72
|
+
groups: this.groups,
|
|
73
|
+
formatParts: L(this.localeId, this.timeLocaleData.effectiveHourFormat),
|
|
74
|
+
getDescriptor: (r) => this.getPartDescriptor(r),
|
|
75
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
76
|
+
getPartAriaLabel: (r, a) => ({
|
|
77
|
+
hour: this.hourAriaLabel,
|
|
78
|
+
minute: this.minuteAriaLabel
|
|
79
|
+
})[a] ?? A[a],
|
|
80
|
+
dayPeriodAriaLabel: this.dayPeriodAriaLabel,
|
|
81
|
+
disabled: this.disabled,
|
|
82
|
+
partsReadonly: !!this.readOnly
|
|
83
|
+
}, l = {
|
|
84
|
+
"gui-widget-icon": !0,
|
|
85
|
+
[this.icon]: !0
|
|
86
|
+
};
|
|
87
|
+
return d`
|
|
88
|
+
${this.label ? y(this.uid, s, !1, void 0, !1) : n}
|
|
89
|
+
|
|
90
|
+
<div class="gui-widget">
|
|
91
|
+
<div
|
|
92
|
+
id=${this.uid}
|
|
93
|
+
class="gui-widget-input gui-parts gui-parts-ring gui-time-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
94
|
+
role="group"
|
|
95
|
+
aria-labelledby=${`${this.uid}_label`}
|
|
96
|
+
>
|
|
97
|
+
${E("default", o, this._parts)}
|
|
98
|
+
</div>
|
|
99
|
+
${this.icon ? d`<span
|
|
100
|
+
class=${c(l)}
|
|
101
|
+
data-icon=${this.icon}
|
|
102
|
+
aria-hidden="true"
|
|
103
|
+
></span>` : n}
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
${this.showErrors && this.errors?.length ? b(this.uid, s) : n}
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
validateAndEmit(s) {
|
|
110
|
+
const { effectiveHourFormat: o, descriptors: l } = this.timeLocaleData, { result: r, writeBacks: a } = D(this._parts.values[s] ?? {}, {
|
|
111
|
+
hourFormat: o,
|
|
112
|
+
descriptors: l
|
|
113
|
+
});
|
|
114
|
+
if (this._parts.applyWriteBacks(s, a), r.kind !== "valid") {
|
|
115
|
+
this.requestUpdate();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const u = T(r.iso, {
|
|
119
|
+
minTime: this.minTime,
|
|
120
|
+
maxTime: this.maxTime,
|
|
121
|
+
minTimeMessage: this.minTimeMessage,
|
|
122
|
+
maxTimeMessage: this.maxTimeMessage
|
|
123
|
+
});
|
|
124
|
+
if (u) {
|
|
125
|
+
this.dispatchEvent(
|
|
126
|
+
new CustomEvent("change", { detail: { value: r.iso }, bubbles: !0 })
|
|
127
|
+
), this.dispatchEvent(
|
|
128
|
+
new CustomEvent("inputError", { detail: { message: u }, bubbles: !0 })
|
|
129
|
+
), this.requestUpdate();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.value = r.iso, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value }, bubbles: !0 })), this.requestUpdate();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
e([
|
|
136
|
+
i({ type: String })
|
|
137
|
+
], t.prototype, "uid", 2);
|
|
138
|
+
e([
|
|
139
|
+
i({ type: String })
|
|
140
|
+
], t.prototype, "label", 2);
|
|
141
|
+
e([
|
|
142
|
+
i({ type: String, attribute: "locale-id" })
|
|
143
|
+
], t.prototype, "localeId", 2);
|
|
144
|
+
e([
|
|
145
|
+
i({ type: Array })
|
|
146
|
+
], t.prototype, "errors", 2);
|
|
147
|
+
e([
|
|
148
|
+
i({ type: Boolean })
|
|
149
|
+
], t.prototype, "showErrors", 2);
|
|
150
|
+
e([
|
|
151
|
+
i({ type: Boolean })
|
|
152
|
+
], t.prototype, "touched", 2);
|
|
153
|
+
e([
|
|
154
|
+
i({ type: Boolean })
|
|
155
|
+
], t.prototype, "required", 2);
|
|
156
|
+
e([
|
|
157
|
+
i({ type: Boolean })
|
|
158
|
+
], t.prototype, "disabled", 2);
|
|
159
|
+
e([
|
|
160
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
161
|
+
], t.prototype, "readOnly", 2);
|
|
162
|
+
e([
|
|
163
|
+
i({ type: String })
|
|
164
|
+
], t.prototype, "icon", 2);
|
|
165
|
+
e([
|
|
166
|
+
i({ type: String })
|
|
167
|
+
], t.prototype, "hint", 2);
|
|
168
|
+
e([
|
|
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 })
|
|
179
|
+
], t.prototype, "value", 2);
|
|
180
|
+
e([
|
|
181
|
+
i({ type: String, attribute: "hour-format" })
|
|
182
|
+
], t.prototype, "hourFormat", 2);
|
|
183
|
+
e([
|
|
184
|
+
i({ type: Number, attribute: "minute-step" })
|
|
185
|
+
], t.prototype, "minuteStep", 2);
|
|
186
|
+
e([
|
|
187
|
+
i({ type: String, attribute: "min-time" })
|
|
188
|
+
], t.prototype, "minTime", 2);
|
|
189
|
+
e([
|
|
190
|
+
i({ type: String, attribute: "max-time" })
|
|
191
|
+
], t.prototype, "maxTime", 2);
|
|
192
|
+
e([
|
|
193
|
+
i({ type: String, attribute: "min-time-message" })
|
|
194
|
+
], t.prototype, "minTimeMessage", 2);
|
|
195
|
+
e([
|
|
196
|
+
i({ type: String, attribute: "max-time-message" })
|
|
197
|
+
], t.prototype, "maxTimeMessage", 2);
|
|
198
|
+
t = e([
|
|
199
|
+
m("gui-time")
|
|
200
|
+
], t);
|
|
201
|
+
typeof customElements < "u" && !customElements.get("gui-time") && customElements.define("gui-time", t);
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { LitElement as v, html as p, nothing as b } from "lit";
|
|
2
|
+
import { property as l, customElement as _ } from "lit/decorators.js";
|
|
3
|
+
import { classMap as S } from "lit/directives/class-map.js";
|
|
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-VORbpgs2.js";
|
|
6
|
+
var A = Object.defineProperty, C = Object.getOwnPropertyDescriptor, r = (t, e, i, o) => {
|
|
7
|
+
for (var n = o > 1 ? void 0 : o ? C(e, i) : e, a = t.length - 1, u; a >= 0; a--)
|
|
8
|
+
(u = t[a]) && (n = (o ? u(e, i, n) : u(n)) || n);
|
|
9
|
+
return o && n && A(e, i, n), n;
|
|
10
|
+
};
|
|
11
|
+
let s = class extends v {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.uid = void 0, this.value = void 0, this.label = void 0, this.minTime = void 0, this.maxTime = void 0, this.minuteStep = void 0, this.disabledRanges = void 0, this.localeId = void 0, this.hourFormat = void 0, this.disabled = !1, this.readOnly = !1, this.height = void 0, this.itemHeight = void 0, this.columns = void 0, this.noAvailableTimesMessage = void 0;
|
|
14
|
+
}
|
|
15
|
+
createRenderRoot() {
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
get effectiveColumns() {
|
|
19
|
+
return this.columns || 1;
|
|
20
|
+
}
|
|
21
|
+
get timeOptions() {
|
|
22
|
+
const t = $(this.localeId, this.hourFormat), e = [
|
|
23
|
+
this.localeId,
|
|
24
|
+
t,
|
|
25
|
+
this.minTime,
|
|
26
|
+
this.maxTime,
|
|
27
|
+
this.minuteStep,
|
|
28
|
+
JSON.stringify(this.disabledRanges ?? null)
|
|
29
|
+
].join("|");
|
|
30
|
+
return this._optionsCache?.key !== e && (this._optionsCache = {
|
|
31
|
+
key: e,
|
|
32
|
+
options: w({
|
|
33
|
+
minTime: this.minTime,
|
|
34
|
+
maxTime: this.maxTime,
|
|
35
|
+
minuteStep: this.minuteStep,
|
|
36
|
+
disabledRanges: this.disabledRanges
|
|
37
|
+
}).map((i) => ({
|
|
38
|
+
...i,
|
|
39
|
+
template: I(i.value, this.localeId, t)
|
|
40
|
+
}))
|
|
41
|
+
}), this._optionsCache.options;
|
|
42
|
+
}
|
|
43
|
+
isSelected(t) {
|
|
44
|
+
return this.value != null && E(t.value, this.value) === 0;
|
|
45
|
+
}
|
|
46
|
+
get rovingIndex() {
|
|
47
|
+
const t = this.timeOptions, e = t.findIndex((i) => this.isSelected(i) && !i.disabled);
|
|
48
|
+
return e !== -1 ? e : t.findIndex((i) => !i.disabled);
|
|
49
|
+
}
|
|
50
|
+
scrollToSelectedValue() {
|
|
51
|
+
const t = this.querySelector(".gui-time-list__viewport"), e = this.querySelector(".gui-time-list__option--selected") ?? this.querySelector(".gui-time-list__option");
|
|
52
|
+
if (t && e) {
|
|
53
|
+
const i = t.getBoundingClientRect(), o = e.getBoundingClientRect(), n = t.scrollTop + (o.top - i.top) - i.height / 2 + o.height / 2;
|
|
54
|
+
t.scrollTop = Math.max(0, n);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
focusSelectedOption() {
|
|
58
|
+
this.querySelector('.gui-time-list__option[tabindex="0"]')?.focus();
|
|
59
|
+
}
|
|
60
|
+
selectOption(t, e) {
|
|
61
|
+
e.stopPropagation(), !(this.disabled || this.readOnly || t.disabled) && (this.value = t.value, this.dispatchEvent(
|
|
62
|
+
new CustomEvent("change", {
|
|
63
|
+
detail: { value: t.value },
|
|
64
|
+
bubbles: !0,
|
|
65
|
+
composed: !0
|
|
66
|
+
})
|
|
67
|
+
));
|
|
68
|
+
}
|
|
69
|
+
onKeyDown(t) {
|
|
70
|
+
const e = t.target;
|
|
71
|
+
if (!e.classList.contains("gui-time-list__option")) return;
|
|
72
|
+
const i = Array.from(this.querySelectorAll(".gui-time-list__option")), o = i.indexOf(e), n = this.effectiveColumns, a = window.getComputedStyle(this).direction === "rtl", u = (m) => this.timeOptions[m].disabled;
|
|
73
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
74
|
+
t.preventDefault();
|
|
75
|
+
const m = this.timeOptions[o];
|
|
76
|
+
m && this.selectOption(m, t);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const d = O(t.key, {
|
|
80
|
+
columns: n,
|
|
81
|
+
isRTL: a,
|
|
82
|
+
pageSize: x(this.height, this.itemHeight, n)
|
|
83
|
+
});
|
|
84
|
+
if (d.kind === "none") return;
|
|
85
|
+
if (t.preventDefault(), d.kind === "edge") {
|
|
86
|
+
const m = d.edge === "first" ? 0 : i.length - 1, y = f(
|
|
87
|
+
m,
|
|
88
|
+
d.edge === "first" ? 1 : -1,
|
|
89
|
+
this.timeOptions.length,
|
|
90
|
+
u,
|
|
91
|
+
{ includeStart: !0, outOfBounds: "none" }
|
|
92
|
+
);
|
|
93
|
+
y !== -1 && i[y].focus();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const c = d.delta, g = Math.min(Math.max(o + c, 0), i.length - 1);
|
|
97
|
+
if (g === o) return;
|
|
98
|
+
const h = f(
|
|
99
|
+
g,
|
|
100
|
+
c > 0 ? 1 : -1,
|
|
101
|
+
this.timeOptions.length,
|
|
102
|
+
u,
|
|
103
|
+
{ includeStart: !0, outOfBounds: "none" }
|
|
104
|
+
);
|
|
105
|
+
h !== -1 && h !== o && i[h].focus();
|
|
106
|
+
}
|
|
107
|
+
renderOption(t, e, i) {
|
|
108
|
+
const o = this.isSelected(t);
|
|
109
|
+
return p`
|
|
110
|
+
<button
|
|
111
|
+
type="button"
|
|
112
|
+
role=${i}
|
|
113
|
+
class=${S({
|
|
114
|
+
"gui-time-list__option": !0,
|
|
115
|
+
"gui-time-list__option--selected": o
|
|
116
|
+
})}
|
|
117
|
+
tabindex=${e === this.rovingIndex ? 0 : -1}
|
|
118
|
+
?disabled=${t.disabled || this.disabled}
|
|
119
|
+
data-value=${t.value}
|
|
120
|
+
aria-selected=${o}
|
|
121
|
+
aria-disabled=${t.disabled || this.disabled ? "true" : "false"}
|
|
122
|
+
@click=${(a) => this.selectOption(t, a)}
|
|
123
|
+
>
|
|
124
|
+
${t.template}
|
|
125
|
+
</button>
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
render() {
|
|
129
|
+
const t = this.timeOptions;
|
|
130
|
+
if (t.length === 0)
|
|
131
|
+
return p`<div class="gui-time-list__empty">
|
|
132
|
+
${this.noAvailableTimesMessage ?? R}
|
|
133
|
+
</div>`;
|
|
134
|
+
const e = this.effectiveColumns, i = `--gui-time-list-height: ${this.height ?? 300}px; --gui-time-list-item-height: ${this.itemHeight || 40}px; --gui-time-list-columns: ${e};`;
|
|
135
|
+
if (e === 1)
|
|
136
|
+
return p`
|
|
137
|
+
<div
|
|
138
|
+
class="gui-time-list__viewport"
|
|
139
|
+
role="listbox"
|
|
140
|
+
style=${i}
|
|
141
|
+
aria-label=${this.label ?? b}
|
|
142
|
+
@keydown=${this.onKeyDown}
|
|
143
|
+
>
|
|
144
|
+
${t.map((n, a) => this.renderOption(n, a, "option"))}
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
const o = T(t, e);
|
|
148
|
+
return p`
|
|
149
|
+
<div
|
|
150
|
+
class="gui-time-list__viewport gui-time-list__viewport--grid"
|
|
151
|
+
role="grid"
|
|
152
|
+
style=${i}
|
|
153
|
+
aria-label=${this.label ?? b}
|
|
154
|
+
@keydown=${this.onKeyDown}
|
|
155
|
+
>
|
|
156
|
+
${o.map(
|
|
157
|
+
(n, a) => p`
|
|
158
|
+
<div role="row" class="gui-time-list__row">
|
|
159
|
+
${n.map(
|
|
160
|
+
(u, d) => this.renderOption(u, a * e + d, "gridcell")
|
|
161
|
+
)}
|
|
162
|
+
</div>
|
|
163
|
+
`
|
|
164
|
+
)}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
r([
|
|
170
|
+
l({ type: String })
|
|
171
|
+
], s.prototype, "uid", 2);
|
|
172
|
+
r([
|
|
173
|
+
l({ type: String })
|
|
174
|
+
], s.prototype, "value", 2);
|
|
175
|
+
r([
|
|
176
|
+
l({ type: String })
|
|
177
|
+
], s.prototype, "label", 2);
|
|
178
|
+
r([
|
|
179
|
+
l({ type: String, attribute: "min-time" })
|
|
180
|
+
], s.prototype, "minTime", 2);
|
|
181
|
+
r([
|
|
182
|
+
l({ type: String, attribute: "max-time" })
|
|
183
|
+
], s.prototype, "maxTime", 2);
|
|
184
|
+
r([
|
|
185
|
+
l({ type: Number, attribute: "minute-step" })
|
|
186
|
+
], s.prototype, "minuteStep", 2);
|
|
187
|
+
r([
|
|
188
|
+
l({ type: Array, attribute: "disabled-ranges" })
|
|
189
|
+
], s.prototype, "disabledRanges", 2);
|
|
190
|
+
r([
|
|
191
|
+
l({ type: String, attribute: "locale-id" })
|
|
192
|
+
], s.prototype, "localeId", 2);
|
|
193
|
+
r([
|
|
194
|
+
l({ type: String, attribute: "hour-format" })
|
|
195
|
+
], s.prototype, "hourFormat", 2);
|
|
196
|
+
r([
|
|
197
|
+
l({ type: Boolean })
|
|
198
|
+
], s.prototype, "disabled", 2);
|
|
199
|
+
r([
|
|
200
|
+
l({ type: Boolean, attribute: "readonly" })
|
|
201
|
+
], s.prototype, "readOnly", 2);
|
|
202
|
+
r([
|
|
203
|
+
l({ type: Number })
|
|
204
|
+
], s.prototype, "height", 2);
|
|
205
|
+
r([
|
|
206
|
+
l({ type: Number, attribute: "item-height" })
|
|
207
|
+
], s.prototype, "itemHeight", 2);
|
|
208
|
+
r([
|
|
209
|
+
l({ type: Number })
|
|
210
|
+
], s.prototype, "columns", 2);
|
|
211
|
+
r([
|
|
212
|
+
l({ type: String, attribute: "no-available-times-message" })
|
|
213
|
+
], s.prototype, "noAvailableTimesMessage", 2);
|
|
214
|
+
s = r([
|
|
215
|
+
_("gui-time-list")
|
|
216
|
+
], s);
|
|
217
|
+
typeof customElements < "u" && !customElements.get("gui-time-list") && customElements.define("gui-time-list", s);
|