@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,299 @@
|
|
|
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
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
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
|
+
};
|
|
15
|
+
let t = class extends h {
|
|
16
|
+
constructor() {
|
|
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, {
|
|
18
|
+
focusRestoreSelector: "gui-time input, gui-time button",
|
|
19
|
+
focusPopupSelector: '.gui-time-list__option[tabindex="0"]',
|
|
20
|
+
isDisabled: () => !!this.disabled,
|
|
21
|
+
clickIntent: (e) => e.closest(".gui-time-list__option") ? "ignore" : e.closest("gui-time") || e.closest("gui-time-list") ? "open" : "toggle",
|
|
22
|
+
keyToggleMode: "openClose",
|
|
23
|
+
onOpenChanged: (e) => {
|
|
24
|
+
this.dispatchListToggle(e), e && this.updateComplete.then(() => this._listRef?.scrollToSelectedValue());
|
|
25
|
+
}
|
|
26
|
+
}), this.onToggleClick = (e) => {
|
|
27
|
+
e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
|
|
28
|
+
}, this.onKeyDown = (e) => {
|
|
29
|
+
if (this._popup.onAnchorKeyDown(e)) return;
|
|
30
|
+
if (e.key === "Enter" && e.target.closest("gui-time")) {
|
|
31
|
+
this._popup.open && this._popup.close(), this.commitValue(this.value, !0);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.allowCustomTime || this.readOnly || this.disabled || e.key !== "ArrowDown" && e.key !== "ArrowUp" || !e.target.closest("gui-time") || (e.preventDefault(), this.selectAdjacentOption(e.key === "ArrowDown" ? 1 : -1));
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
createRenderRoot() {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
updated(e) {
|
|
41
|
+
e.has("value") && this._listRef && this._listRef.value !== this.value && (this._listRef.value = this.value);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
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
|
+
)}
|
|
57
|
+
|
|
58
|
+
<div class="gui-widget" @keydown=${this.onKeyDown} @click=${this._popup.onAnchorClick}>
|
|
59
|
+
<gui-time
|
|
60
|
+
id="time-input"
|
|
61
|
+
class=${g(e.widgetClasses)}
|
|
62
|
+
.uid=${this.uid}
|
|
63
|
+
.hint=${this.hint}
|
|
64
|
+
.showErrors=${!1}
|
|
65
|
+
.errors=${this.errors}
|
|
66
|
+
?touched=${this.touched}
|
|
67
|
+
?required=${this.required}
|
|
68
|
+
?disabled=${this.disabled}
|
|
69
|
+
?readonly=${this.readOnly || !this.allowCustomTime}
|
|
70
|
+
.value=${this.value}
|
|
71
|
+
.icon=${this.icon}
|
|
72
|
+
.localeId=${this.localeId}
|
|
73
|
+
.hourFormat=${this.hourFormat}
|
|
74
|
+
.minuteStep=${this.minuteStep}
|
|
75
|
+
.minTime=${this.minTime}
|
|
76
|
+
.maxTime=${this.maxTime}
|
|
77
|
+
.hourAriaLabel=${this.hourAriaLabel}
|
|
78
|
+
.minuteAriaLabel=${this.minuteAriaLabel}
|
|
79
|
+
.dayPeriodAriaLabel=${this.dayPeriodAriaLabel}
|
|
80
|
+
.minTimeMessage=${this.minTimeMessage}
|
|
81
|
+
.maxTimeMessage=${this.maxTimeMessage}
|
|
82
|
+
@blur=${this.onTimeBlur}
|
|
83
|
+
@focus=${this._popup.show}
|
|
84
|
+
@change=${this.onTimeChange}
|
|
85
|
+
></gui-time>
|
|
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
|
+
>
|
|
103
|
+
<path
|
|
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"
|
|
105
|
+
></path>
|
|
106
|
+
</svg>
|
|
107
|
+
</button>
|
|
108
|
+
|
|
109
|
+
<gui-time-list
|
|
110
|
+
id=${`${this.uid}_popup`}
|
|
111
|
+
role="dialog"
|
|
112
|
+
aria-label=${this.label ?? "Time list"}
|
|
113
|
+
.uid=${this.uid}
|
|
114
|
+
.value=${this.value}
|
|
115
|
+
.label=${this.label}
|
|
116
|
+
.localeId=${this.localeId}
|
|
117
|
+
.hourFormat=${this.hourFormat}
|
|
118
|
+
.minuteStep=${this.minuteStep}
|
|
119
|
+
.minTime=${this.minTime}
|
|
120
|
+
.maxTime=${this.maxTime}
|
|
121
|
+
.disabledRanges=${this.disabledRanges}
|
|
122
|
+
.height=${this.height}
|
|
123
|
+
.itemHeight=${this.itemHeight}
|
|
124
|
+
.columns=${this.columns}
|
|
125
|
+
.noAvailableTimesMessage=${this.noAvailableTimesMessage}
|
|
126
|
+
?readonly=${this.readOnly}
|
|
127
|
+
?hidden=${!this._popup.open}
|
|
128
|
+
@change=${this.onListChange}
|
|
129
|
+
></gui-time-list>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
${this.showErrors ? $(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
onTimeChange(e) {
|
|
136
|
+
e.stopPropagation(), this.commitValue(e.detail.value);
|
|
137
|
+
}
|
|
138
|
+
onTimeBlur() {
|
|
139
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
140
|
+
}
|
|
141
|
+
onListChange(e) {
|
|
142
|
+
e.stopPropagation(), this.commitValue(e.detail.value, !0), this._popup.restoreFocusToInput(), this._popup.close();
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @param commit Marks the change as a deliberate final selection (list pick
|
|
146
|
+
* or Enter) as opposed to continuous field editing (typing/arrows). A host
|
|
147
|
+
* popover (the date-time calendar) closes only on a committed change, so
|
|
148
|
+
* editing the time in place doesn't dismiss it mid-entry.
|
|
149
|
+
*/
|
|
150
|
+
commitValue(e, o = !1) {
|
|
151
|
+
this.value = e ?? void 0;
|
|
152
|
+
const r = this.validateBounds(this.value);
|
|
153
|
+
this.dispatchEvent(
|
|
154
|
+
new CustomEvent("change", {
|
|
155
|
+
detail: { value: e ?? null, commit: o },
|
|
156
|
+
bubbles: !0,
|
|
157
|
+
composed: !0
|
|
158
|
+
})
|
|
159
|
+
), r && this.dispatchEvent(
|
|
160
|
+
new CustomEvent("inputError", {
|
|
161
|
+
detail: { message: r },
|
|
162
|
+
bubbles: !0,
|
|
163
|
+
composed: !0
|
|
164
|
+
})
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
validateBounds(e) {
|
|
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);
|
|
176
|
+
}
|
|
177
|
+
selectAdjacentOption(e) {
|
|
178
|
+
const o = v({
|
|
179
|
+
minTime: this.minTime,
|
|
180
|
+
maxTime: this.maxTime,
|
|
181
|
+
minuteStep: this.minuteStep,
|
|
182
|
+
disabledRanges: this.disabledRanges
|
|
183
|
+
});
|
|
184
|
+
if (!o.length) return;
|
|
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()));
|
|
190
|
+
}
|
|
191
|
+
/** Public close hook kept for the date-time calendars, which close the
|
|
192
|
+
* embedded time-picker's list imperatively. */
|
|
193
|
+
closeList() {
|
|
194
|
+
this._popup.close();
|
|
195
|
+
}
|
|
196
|
+
dispatchListToggle(e) {
|
|
197
|
+
this.dispatchEvent(
|
|
198
|
+
new CustomEvent("listtoggle", {
|
|
199
|
+
detail: { open: e },
|
|
200
|
+
bubbles: !0,
|
|
201
|
+
composed: !0
|
|
202
|
+
})
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
i([
|
|
207
|
+
s({ type: String })
|
|
208
|
+
], t.prototype, "uid", 2);
|
|
209
|
+
i([
|
|
210
|
+
s({ type: String })
|
|
211
|
+
], t.prototype, "label", 2);
|
|
212
|
+
i([
|
|
213
|
+
s({ type: String })
|
|
214
|
+
], t.prototype, "hint", 2);
|
|
215
|
+
i([
|
|
216
|
+
s({ type: String })
|
|
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);
|
|
230
|
+
i([
|
|
231
|
+
s({ type: Array })
|
|
232
|
+
], t.prototype, "errors", 2);
|
|
233
|
+
i([
|
|
234
|
+
s({ type: Boolean })
|
|
235
|
+
], t.prototype, "showErrors", 2);
|
|
236
|
+
i([
|
|
237
|
+
s({ type: Boolean })
|
|
238
|
+
], t.prototype, "touched", 2);
|
|
239
|
+
i([
|
|
240
|
+
s({ type: Boolean })
|
|
241
|
+
], t.prototype, "required", 2);
|
|
242
|
+
i([
|
|
243
|
+
s({ type: Boolean })
|
|
244
|
+
], t.prototype, "disabled", 2);
|
|
245
|
+
i([
|
|
246
|
+
s({ type: Boolean, attribute: "readonly" })
|
|
247
|
+
], t.prototype, "readOnly", 2);
|
|
248
|
+
i([
|
|
249
|
+
s({ type: String, attribute: "locale-id" })
|
|
250
|
+
], t.prototype, "localeId", 2);
|
|
251
|
+
i([
|
|
252
|
+
s({ type: String })
|
|
253
|
+
], t.prototype, "value", 2);
|
|
254
|
+
i([
|
|
255
|
+
s({ type: String, attribute: "hour-format" })
|
|
256
|
+
], t.prototype, "hourFormat", 2);
|
|
257
|
+
i([
|
|
258
|
+
s({ type: Number, attribute: "minute-step" })
|
|
259
|
+
], t.prototype, "minuteStep", 2);
|
|
260
|
+
i([
|
|
261
|
+
s({ type: String, attribute: "min-time" })
|
|
262
|
+
], t.prototype, "minTime", 2);
|
|
263
|
+
i([
|
|
264
|
+
s({ type: String, attribute: "max-time" })
|
|
265
|
+
], t.prototype, "maxTime", 2);
|
|
266
|
+
i([
|
|
267
|
+
s({ type: Array, attribute: "disabled-ranges" })
|
|
268
|
+
], t.prototype, "disabledRanges", 2);
|
|
269
|
+
i([
|
|
270
|
+
s({ type: Boolean, attribute: "allow-custom-time" })
|
|
271
|
+
], t.prototype, "allowCustomTime", 2);
|
|
272
|
+
i([
|
|
273
|
+
s({ type: Number })
|
|
274
|
+
], t.prototype, "height", 2);
|
|
275
|
+
i([
|
|
276
|
+
s({ type: Number, attribute: "item-height" })
|
|
277
|
+
], t.prototype, "itemHeight", 2);
|
|
278
|
+
i([
|
|
279
|
+
s({ type: Number })
|
|
280
|
+
], t.prototype, "columns", 2);
|
|
281
|
+
i([
|
|
282
|
+
s({ type: String, attribute: "min-time-message" })
|
|
283
|
+
], t.prototype, "minTimeMessage", 2);
|
|
284
|
+
i([
|
|
285
|
+
s({ type: String, attribute: "max-time-message" })
|
|
286
|
+
], t.prototype, "maxTimeMessage", 2);
|
|
287
|
+
i([
|
|
288
|
+
s({ type: String, attribute: "disabled-range-message" })
|
|
289
|
+
], t.prototype, "disabledRangeMessage", 2);
|
|
290
|
+
i([
|
|
291
|
+
s({ type: String, attribute: "no-available-times-message" })
|
|
292
|
+
], t.prototype, "noAvailableTimesMessage", 2);
|
|
293
|
+
i([
|
|
294
|
+
m("gui-time-list")
|
|
295
|
+
], t.prototype, "_listRef", 2);
|
|
296
|
+
t = i([
|
|
297
|
+
d("gui-time-picker")
|
|
298
|
+
], t);
|
|
299
|
+
typeof customElements < "u" && !customElements.get("gui-time-picker") && customElements.define("gui-time-picker", t);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { InputWidgetAdapter as d, formContext as u, inputContext as m } from "@golemui/lit";
|
|
2
|
+
import "./time-picker-g337F8d0.js";
|
|
3
|
+
import { consume as p, provide as h } from "@lit/context";
|
|
4
|
+
import { LitElement as c, html as g } from "lit";
|
|
5
|
+
import { property as b, customElement as $ } from "lit/decorators.js";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (e, t, s, a) => {
|
|
8
|
+
for (var i = a > 1 ? void 0 : a ? v(t, s) : t, o = e.length - 1, n; o >= 0; o--)
|
|
9
|
+
(n = e[o]) && (i = (a ? n(t, s, i) : n(i)) || i);
|
|
10
|
+
return a && i && f(t, s, i), i;
|
|
11
|
+
};
|
|
12
|
+
let r = class extends c {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.adapter = new d(), this.subscriptions = [];
|
|
15
|
+
}
|
|
16
|
+
createRenderRoot() {
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
updated(e) {
|
|
20
|
+
super.updated(e);
|
|
21
|
+
const t = this.adapter.templateData.size;
|
|
22
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback(), this.classList.add("gui-time-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
26
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
super.render();
|
|
31
|
+
const e = this.adapter.templateData;
|
|
32
|
+
return g`
|
|
33
|
+
<gui-time-picker
|
|
34
|
+
.uid=${this.widget.uid}
|
|
35
|
+
.label=${e.label}
|
|
36
|
+
.hint=${e.hint}
|
|
37
|
+
.errors=${e.errors}
|
|
38
|
+
?touched=${e.touched}
|
|
39
|
+
?required=${e.validator?.required}
|
|
40
|
+
?disabled=${e.disabled}
|
|
41
|
+
?readonly=${e.readonly}
|
|
42
|
+
.value=${e.value}
|
|
43
|
+
.icon=${e.icon}
|
|
44
|
+
.localeId=${e.lang}
|
|
45
|
+
.toggleAriaLabel=${e.toggleAriaLabel}
|
|
46
|
+
.hourAriaLabel=${e.hourAriaLabel}
|
|
47
|
+
.minuteAriaLabel=${e.minuteAriaLabel}
|
|
48
|
+
.dayPeriodAriaLabel=${e.dayPeriodAriaLabel}
|
|
49
|
+
.hourFormat=${e.hourFormat}
|
|
50
|
+
.minuteStep=${e.minuteStep}
|
|
51
|
+
.minTime=${e.minTime}
|
|
52
|
+
.maxTime=${e.maxTime}
|
|
53
|
+
.disabledRanges=${e.disabledRanges}
|
|
54
|
+
?allow-custom-time=${e.allowCustomTime}
|
|
55
|
+
.height=${e.height}
|
|
56
|
+
.itemHeight=${e.itemHeight}
|
|
57
|
+
.minTimeMessage=${e.minTimeMessage}
|
|
58
|
+
.maxTimeMessage=${e.maxTimeMessage}
|
|
59
|
+
.disabledRangeMessage=${e.disabledRangeMessage}
|
|
60
|
+
.noAvailableTimesMessage=${e.noAvailableTimesMessage}
|
|
61
|
+
@inputError=${this.onInputError}
|
|
62
|
+
@blur=${() => this.adapter.onBlur()}
|
|
63
|
+
@change=${this.valueChanged}
|
|
64
|
+
></gui-time-picker>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
valueChanged(e) {
|
|
68
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
69
|
+
}
|
|
70
|
+
onInputError(e) {
|
|
71
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
72
|
+
}
|
|
73
|
+
disconnectedCallback() {
|
|
74
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
l([
|
|
78
|
+
p({ context: u }),
|
|
79
|
+
b({ attribute: !1 })
|
|
80
|
+
], r.prototype, "formContext", 2);
|
|
81
|
+
l([
|
|
82
|
+
h({ context: m })
|
|
83
|
+
], r.prototype, "adapter", 2);
|
|
84
|
+
r = l([
|
|
85
|
+
$("gui-time-picker-input")
|
|
86
|
+
], r);
|
|
87
|
+
export {
|
|
88
|
+
r as TimePickerElement
|
|
89
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { InputWidgetAdapter as o, formContext as m, inputContext as n } from "@golemui/lit";
|
|
2
|
+
import { a as h } from "./templates-Dmr34nwp.js";
|
|
3
|
+
import "./time-input-5dkSm8UW.js";
|
|
4
|
+
import { consume as u, provide as c } from "@lit/context";
|
|
5
|
+
import { LitElement as b, html as $ } from "lit";
|
|
6
|
+
import { property as D, customElement as g } from "lit/decorators.js";
|
|
7
|
+
import "rxjs";
|
|
8
|
+
import { classMap as f } from "lit/directives/class-map.js";
|
|
9
|
+
var v = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (t, e, s, i) => {
|
|
10
|
+
for (var a = i > 1 ? void 0 : i ? x(e, s) : e, p = t.length - 1, d; p >= 0; p--)
|
|
11
|
+
(d = t[p]) && (a = (i ? d(e, s, a) : d(a)) || a);
|
|
12
|
+
return i && a && v(e, s, a), a;
|
|
13
|
+
};
|
|
14
|
+
let r = class extends b {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments), this.adapter = new o(), this.subscriptions = [];
|
|
17
|
+
}
|
|
18
|
+
createRenderRoot() {
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
updated(t) {
|
|
22
|
+
super.updated(t);
|
|
23
|
+
const e = this.adapter.templateData.size;
|
|
24
|
+
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
super.connectedCallback(), this.classList.add("gui-time", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
28
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
super.render();
|
|
33
|
+
const t = h("time", this.adapter.templateData);
|
|
34
|
+
return $`
|
|
35
|
+
<gui-time
|
|
36
|
+
class=${f(t.widgetClasses)}
|
|
37
|
+
.uid=${this.widget.uid}
|
|
38
|
+
.label=${this.adapter.templateData.label}
|
|
39
|
+
.hint=${this.adapter.templateData.hint}
|
|
40
|
+
.errors=${this.adapter.templateData.errors}
|
|
41
|
+
?touched=${this.adapter.templateData.touched}
|
|
42
|
+
?required=${this.adapter.templateData.validator?.required}
|
|
43
|
+
?disabled=${this.adapter.templateData.disabled}
|
|
44
|
+
?readonly=${this.adapter.templateData.readonly}
|
|
45
|
+
.value=${this.adapter.templateData.value}
|
|
46
|
+
.icon=${this.adapter.templateData.icon}
|
|
47
|
+
.localeId=${this.adapter.templateData.lang}
|
|
48
|
+
.hourAriaLabel=${this.adapter.templateData.hourAriaLabel}
|
|
49
|
+
.minuteAriaLabel=${this.adapter.templateData.minuteAriaLabel}
|
|
50
|
+
.dayPeriodAriaLabel=${this.adapter.templateData.dayPeriodAriaLabel}
|
|
51
|
+
.hourFormat=${this.adapter.templateData.hourFormat}
|
|
52
|
+
.minuteStep=${this.adapter.templateData.minuteStep}
|
|
53
|
+
.minTime=${this.adapter.templateData.minTime}
|
|
54
|
+
.maxTime=${this.adapter.templateData.maxTime}
|
|
55
|
+
.minTimeMessage=${this.adapter.templateData.minTimeMessage}
|
|
56
|
+
.maxTimeMessage=${this.adapter.templateData.maxTimeMessage}
|
|
57
|
+
@inputError=${this.onInputError}
|
|
58
|
+
@blur=${() => this.adapter.onBlur()}
|
|
59
|
+
@change=${this.valueChanged}
|
|
60
|
+
></gui-time>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
valueChanged(t) {
|
|
64
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
|
|
65
|
+
}
|
|
66
|
+
onInputError(t) {
|
|
67
|
+
this.adapter.injectValidationIssues([t.detail.message]);
|
|
68
|
+
}
|
|
69
|
+
disconnectedCallback() {
|
|
70
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
l([
|
|
74
|
+
u({ context: m }),
|
|
75
|
+
D({ attribute: !1 })
|
|
76
|
+
], r.prototype, "formContext", 2);
|
|
77
|
+
l([
|
|
78
|
+
c({ context: n })
|
|
79
|
+
], r.prototype, "adapter", 2);
|
|
80
|
+
r = l([
|
|
81
|
+
g("gui-time-input")
|
|
82
|
+
], r);
|
|
83
|
+
export {
|
|
84
|
+
r as TimeElement
|
|
85
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { InputWidgetAdapter as b, formContext as m, inputContext as y } from "@golemui/lit";
|
|
2
|
-
import { G as v,
|
|
3
|
-
import { LitElement as h, nothing as
|
|
4
|
-
import { property as
|
|
5
|
-
import { consume as
|
|
2
|
+
import { G as v, r as f, c as $ } from "./templates-Dmr34nwp.js";
|
|
3
|
+
import { LitElement as h, nothing as C, html as g } from "lit";
|
|
4
|
+
import { property as a, customElement as c } from "lit/decorators.js";
|
|
5
|
+
import { consume as _, provide as D } from "@lit/context";
|
|
6
6
|
import "rxjs";
|
|
7
|
-
var
|
|
8
|
-
for (var i = o > 1 ? void 0 : o ?
|
|
7
|
+
var P = Object.defineProperty, w = Object.getOwnPropertyDescriptor, s = (t, e, l, o) => {
|
|
8
|
+
for (var i = o > 1 ? void 0 : o ? w(e, l) : e, d = t.length - 1, n; d >= 0; d--)
|
|
9
9
|
(n = t[d]) && (i = (o ? n(e, l, i) : n(i)) || i);
|
|
10
|
-
return o && i &&
|
|
10
|
+
return o && i && P(e, l, i), i;
|
|
11
11
|
};
|
|
12
|
-
let
|
|
12
|
+
let r = class extends h {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.togglePosition = "left", this.ariaController = new v(this, {
|
|
15
|
-
getTargets: () => this.querySelectorAll(
|
|
15
|
+
getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
|
|
16
16
|
getState: () => ({
|
|
17
17
|
uid: this.uid,
|
|
18
18
|
templateData: {
|
|
@@ -21,7 +21,8 @@ let a = class extends h {
|
|
|
21
21
|
touched: this.touched,
|
|
22
22
|
// Checkboxes can't have aria-readonly
|
|
23
23
|
readonly: !1,
|
|
24
|
-
disabled: !1
|
|
24
|
+
disabled: !1,
|
|
25
|
+
required: this.required
|
|
25
26
|
}
|
|
26
27
|
})
|
|
27
28
|
});
|
|
@@ -56,7 +57,7 @@ let a = class extends h {
|
|
|
56
57
|
<div class="gui-widget gui-widget--horizontal gui-toggle--switch">
|
|
57
58
|
<input
|
|
58
59
|
type="checkbox"
|
|
59
|
-
|
|
60
|
+
role="switch"
|
|
60
61
|
id=${this.uid}
|
|
61
62
|
data-cy=${`${this.uid}_toggle`}
|
|
62
63
|
?checked=${t.value}
|
|
@@ -70,12 +71,12 @@ let a = class extends h {
|
|
|
70
71
|
</div>
|
|
71
72
|
|
|
72
73
|
<span class="gui-label__container">
|
|
73
|
-
${t.label
|
|
74
|
+
${t.label}${f(t.required)}
|
|
74
75
|
</span>
|
|
75
76
|
</label>
|
|
76
77
|
|
|
77
78
|
<div class="gui-widget-hint" id=${`${t.uid}_hint`}>
|
|
78
|
-
${t.hint ??
|
|
79
|
+
${t.hint ?? C} ${$(this.uid, t)}
|
|
79
80
|
</div>
|
|
80
81
|
`;
|
|
81
82
|
}
|
|
@@ -101,46 +102,46 @@ let a = class extends h {
|
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
104
|
s([
|
|
104
|
-
|
|
105
|
-
],
|
|
105
|
+
a({ type: String })
|
|
106
|
+
], r.prototype, "uid", 2);
|
|
106
107
|
s([
|
|
107
|
-
|
|
108
|
-
],
|
|
108
|
+
a({ type: String })
|
|
109
|
+
], r.prototype, "label", 2);
|
|
109
110
|
s([
|
|
110
|
-
|
|
111
|
-
],
|
|
111
|
+
a({ type: String, attribute: "locale-id" })
|
|
112
|
+
], r.prototype, "localeId", 2);
|
|
112
113
|
s([
|
|
113
|
-
|
|
114
|
-
],
|
|
114
|
+
a({ type: Array })
|
|
115
|
+
], r.prototype, "errors", 2);
|
|
115
116
|
s([
|
|
116
|
-
|
|
117
|
-
],
|
|
117
|
+
a({ type: Boolean })
|
|
118
|
+
], r.prototype, "touched", 2);
|
|
118
119
|
s([
|
|
119
|
-
|
|
120
|
-
],
|
|
120
|
+
a({ type: Boolean })
|
|
121
|
+
], r.prototype, "required", 2);
|
|
121
122
|
s([
|
|
122
|
-
|
|
123
|
-
],
|
|
123
|
+
a({ type: Boolean })
|
|
124
|
+
], r.prototype, "disabled", 2);
|
|
124
125
|
s([
|
|
125
|
-
|
|
126
|
-
],
|
|
126
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
127
|
+
], r.prototype, "readOnly", 2);
|
|
127
128
|
s([
|
|
128
|
-
|
|
129
|
-
],
|
|
129
|
+
a({ type: String })
|
|
130
|
+
], r.prototype, "value", 2);
|
|
130
131
|
s([
|
|
131
|
-
|
|
132
|
-
],
|
|
132
|
+
a({ type: String })
|
|
133
|
+
], r.prototype, "hint", 2);
|
|
133
134
|
s([
|
|
134
|
-
|
|
135
|
-
],
|
|
136
|
-
|
|
135
|
+
a({ type: String })
|
|
136
|
+
], r.prototype, "togglePosition", 2);
|
|
137
|
+
r = s([
|
|
137
138
|
c("gui-toggle")
|
|
138
|
-
],
|
|
139
|
-
typeof customElements < "u" && !customElements.get("gui-toggle") && customElements.define("gui-toggle",
|
|
140
|
-
var
|
|
139
|
+
], r);
|
|
140
|
+
typeof customElements < "u" && !customElements.get("gui-toggle") && customElements.define("gui-toggle", r);
|
|
141
|
+
var q = Object.defineProperty, x = Object.getOwnPropertyDescriptor, p = (t, e, l, o) => {
|
|
141
142
|
for (var i = o > 1 ? void 0 : o ? x(e, l) : e, d = t.length - 1, n; d >= 0; d--)
|
|
142
143
|
(n = t[d]) && (i = (o ? n(e, l, i) : n(i)) || i);
|
|
143
|
-
return o && i &&
|
|
144
|
+
return o && i && q(e, l, i), i;
|
|
144
145
|
};
|
|
145
146
|
let u = class extends h {
|
|
146
147
|
constructor() {
|
|
@@ -186,11 +187,11 @@ let u = class extends h {
|
|
|
186
187
|
}
|
|
187
188
|
};
|
|
188
189
|
p([
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
_({ context: m }),
|
|
191
|
+
a({ attribute: !1 })
|
|
191
192
|
], u.prototype, "formContext", 2);
|
|
192
193
|
p([
|
|
193
|
-
|
|
194
|
+
D({ context: y })
|
|
194
195
|
], u.prototype, "adapter", 2);
|
|
195
196
|
u = p([
|
|
196
197
|
c("gui-toggle-input")
|