@golemui/gui-lit 1.0.2 → 1.1.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/calendar-BuJgwvZx.js +254 -0
  3. package/{calendar.element-MubSE1bx.js → calendar.element-M5MPJmap.js} +1 -1
  4. package/{currency.element-BHXWcOEu.js → currency.element-CfFrAtrr.js} +20 -14
  5. package/{date-DTYg8sog.js → date-Bj9mI3GU.js} +106 -50
  6. package/date-input-cJDkNnVw.js +184 -0
  7. package/date-picker.element-va_-LGZD.js +312 -0
  8. package/date-time-calendar-BzRfkLKU.js +361 -0
  9. package/date-time-calendar.element-DC4NK0y1.js +93 -0
  10. package/date-time-input-BXxsfuyZ.js +214 -0
  11. package/date-time-picker.element-Dy-8cb-_.js +380 -0
  12. package/date-time.element-Bv4XdzMi.js +87 -0
  13. package/{date.element-BtVJSIRk.js → date.element-Consgsbb.js} +32 -27
  14. package/day-status-0-hJHrI7.js +530 -0
  15. package/{dropdown.element-DqzC6aXR.js → dropdown.element-WsD61Qel.js} +57 -48
  16. package/focus-leave.controller-2gV0pQd5.js +73 -0
  17. package/index.js +1209 -981
  18. package/index.umd.cjs +1574 -519
  19. package/lib/components/date-picker.element.d.ts +0 -11
  20. package/lib/components/date-time-calendar.element.d.ts +18 -0
  21. package/lib/components/date-time-picker.element.d.ts +18 -0
  22. package/lib/components/date-time.element.d.ts +18 -0
  23. package/lib/components/dropdown.element.d.ts +2 -0
  24. package/lib/components/range-calendar.element.d.ts +2 -1
  25. package/lib/components/range-date-picker.element.d.ts +0 -15
  26. package/lib/components/range-date-time-calendar.element.d.ts +18 -0
  27. package/lib/components/range-date-time-input.element.d.ts +18 -0
  28. package/lib/components/range-date-time-picker.element.d.ts +18 -0
  29. package/lib/components/range-time-input.element.d.ts +18 -0
  30. package/lib/components/range-time-picker.element.d.ts +18 -0
  31. package/lib/components/time-picker.element.d.ts +18 -0
  32. package/lib/components/time.element.d.ts +18 -0
  33. package/{list-D1oKnH89.js → list-CrLIL4by.js} +76 -61
  34. package/{list.element-Co3V3Cn5.js → list.element-DV82YxnJ.js} +22 -22
  35. package/{number.element-BhEyoOtc.js → number.element-CBr47IiY.js} +18 -16
  36. package/numeric-jmOOKz30.js +12 -0
  37. package/package.json +6 -6
  38. package/part-templates-Db871PS3.js +677 -0
  39. package/pill-ranges-DCqDmpkk.js +48 -0
  40. package/{pills-B66qz_KX.js → pills-Be1UrLgq.js} +4 -1
  41. package/popup.controller-eUDxE6jD.js +71 -0
  42. package/range-calendar-CKPYeSGt.js +452 -0
  43. package/{range-calendar.element-QTE6vGNP.js → range-calendar.element-D6KYq18B.js} +24 -20
  44. package/range-commit-8-MmYUyo.js +14 -0
  45. package/range-date-input-D--AqBMv.js +292 -0
  46. package/{range-date-input.element-Dj29D_OQ.js → range-date-input.element-D4nIXJbw.js} +8 -7
  47. package/range-date-picker.element-dhxPAAE6.js +386 -0
  48. package/range-date-time-calendar-yksWrR7b.js +720 -0
  49. package/range-date-time-calendar.element-C00aDefZ.js +95 -0
  50. package/range-date-time-input-B37TUoM3.js +322 -0
  51. package/range-date-time-input.element-DUnbv4ed.js +81 -0
  52. package/range-date-time-picker.element-Cbps6s_G.js +412 -0
  53. package/range-selection-CU3hxLJE.js +25 -0
  54. package/range-time-input-3lhqR1Ku.js +329 -0
  55. package/range-time-input.element-dU2iBdmJ.js +81 -0
  56. package/range-time-picker.element-v6nQsIPw.js +429 -0
  57. package/{select.element-jcDF1h-g.js → select.element-C0V-Bv3L.js} +94 -90
  58. package/{tags.element-CX3vQL8L.js → tags.element-DvwEpxpK.js} +1 -1
  59. package/time-input-BOhlBGJZ.js +181 -0
  60. package/time-list-Czo48bZm.js +217 -0
  61. package/time-picker-bFJ63ky8.js +261 -0
  62. package/time-picker.element-CYZVXgRS.js +85 -0
  63. package/time.element-fK3oLi49.js +82 -0
  64. package/abstract-calendar-BoqKPRmS.js +0 -545
  65. package/calendar-DTYKVYc3.js +0 -96
  66. package/date-input-BeQvyfln.js +0 -268
  67. package/date-picker.element-DabW_-0-.js +0 -166
  68. package/range-calendar-9skwbwlB.js +0 -255
  69. package/range-date-input-Uy8134vi.js +0 -395
  70. package/range-date-picker.element-CuKIBkIO.js +0 -182
@@ -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-Db871PS3.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);
@@ -0,0 +1,261 @@
1
+ import { LitElement as u, html as m } from "lit";
2
+ import { property as s, query as p, customElement as d } from "lit/decorators.js";
3
+ import { classMap as g } from "lit/directives/class-map.js";
4
+ import "./time-input-BOhlBGJZ.js";
5
+ import "./time-list-Czo48bZm.js";
6
+ import { G as c } from "./popup.controller-eUDxE6jD.js";
7
+ import { h as y, A as b } from "./part-templates-Db871PS3.js";
8
+ import { a as v, b as f, c as T } from "./templates-Dk1jxLwS.js";
9
+ import { b as $ } from "./date-Bj9mI3GU.js";
10
+ var w = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, i = (e, o, a, r) => {
11
+ for (var l = r > 1 ? void 0 : r ? _(o, a) : o, n = e.length - 1, h; n >= 0; n--)
12
+ (h = e[n]) && (l = (r ? h(o, a, l) : h(l)) || l);
13
+ return r && l && w(o, a, l), l;
14
+ };
15
+ let t = class extends u {
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],
19
+ focusRestoreSelector: "gui-time input, gui-time button",
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.onKeyDown = (e) => {
27
+ if (this._popup.onAnchorKeyDown(e)) return;
28
+ if (e.key === "Enter" && e.target.closest("gui-time")) {
29
+ this._popup.open && this._popup.close(), this.commitValue(this.value, !0);
30
+ return;
31
+ }
32
+ 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));
33
+ };
34
+ }
35
+ createRenderRoot() {
36
+ return this;
37
+ }
38
+ updated(e) {
39
+ e.has("value") && this._listRef && this._listRef.value !== this.value && (this._listRef.value = this.value);
40
+ }
41
+ render() {
42
+ const e = v("timePicker", { icon: this.icon });
43
+ return m`
44
+ ${f(this.uid ?? "", {
45
+ label: this.label,
46
+ hint: this.hint,
47
+ required: this.required
48
+ })}
49
+
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
+ >
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
+ .minTimeMessage=${this.minTimeMessage}
78
+ .maxTimeMessage=${this.maxTimeMessage}
79
+ @blur=${this.onTimeBlur}
80
+ @focus=${this._popup.show}
81
+ @change=${this.onTimeChange}
82
+ ></gui-time>
83
+ <span class="gui-time-picker__arrow"
84
+ ><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
85
+ <path
86
+ 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></svg
88
+ ></span>
89
+
90
+ <gui-time-list
91
+ .uid=${this.uid}
92
+ .value=${this.value}
93
+ .label=${this.label}
94
+ .localeId=${this.localeId}
95
+ .hourFormat=${this.hourFormat}
96
+ .minuteStep=${this.minuteStep}
97
+ .minTime=${this.minTime}
98
+ .maxTime=${this.maxTime}
99
+ .disabledRanges=${this.disabledRanges}
100
+ .height=${this.height}
101
+ .itemHeight=${this.itemHeight}
102
+ .columns=${this.columns}
103
+ .noAvailableTimesMessage=${this.noAvailableTimesMessage}
104
+ ?readonly=${this.readOnly}
105
+ ?hidden=${!this._popup.open}
106
+ @change=${this.onListChange}
107
+ ></gui-time-list>
108
+ </div>
109
+
110
+ ${this.showErrors ? T(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
111
+ `;
112
+ }
113
+ onTimeChange(e) {
114
+ e.stopPropagation(), this.commitValue(e.detail.value);
115
+ }
116
+ onTimeBlur() {
117
+ this.dispatchEvent(new CustomEvent("blur"));
118
+ }
119
+ onListChange(e) {
120
+ e.stopPropagation(), this.commitValue(e.detail.value, !0), this._popup.restoreFocusToInput(), this._popup.close();
121
+ }
122
+ /**
123
+ * @param commit Marks the change as a deliberate final selection (list pick
124
+ * or Enter) as opposed to continuous field editing (typing/arrows). A host
125
+ * popover (the date-time calendar) closes only on a committed change, so
126
+ * editing the time in place doesn't dismiss it mid-entry.
127
+ */
128
+ commitValue(e, o = !1) {
129
+ this.value = e ?? void 0;
130
+ const a = this.validateBounds(this.value);
131
+ this.dispatchEvent(
132
+ new CustomEvent("change", {
133
+ detail: { value: e ?? null, commit: o },
134
+ bubbles: !0,
135
+ composed: !0
136
+ })
137
+ ), a && this.dispatchEvent(
138
+ new CustomEvent("inputError", {
139
+ detail: { message: a },
140
+ bubbles: !0,
141
+ composed: !0
142
+ })
143
+ );
144
+ }
145
+ validateBounds(e) {
146
+ return e && y(e, this.disabledRanges) ? this.disabledRangeMessage ?? $ : null;
147
+ }
148
+ selectAdjacentOption(e) {
149
+ const o = b({
150
+ minTime: this.minTime,
151
+ maxTime: this.maxTime,
152
+ minuteStep: this.minuteStep,
153
+ disabledRanges: this.disabledRanges
154
+ });
155
+ if (!o.length) return;
156
+ const a = o.findIndex((l) => l.value === this.value);
157
+ let r = a === -1 ? e === 1 ? 0 : o.length - 1 : a + e;
158
+ for (; r >= 0 && r < o.length && o[r].disabled; )
159
+ r += e;
160
+ r < 0 || r >= o.length || (this.commitValue(o[r].value), this._popup.show(), this.updateComplete.then(() => this._listRef?.scrollToSelectedValue()));
161
+ }
162
+ /** Public close hook kept for the date-time calendars, which close the
163
+ * embedded time-picker's list imperatively. */
164
+ closeList() {
165
+ this._popup.close();
166
+ }
167
+ dispatchListToggle(e) {
168
+ this.dispatchEvent(
169
+ new CustomEvent("listtoggle", {
170
+ detail: { open: e },
171
+ bubbles: !0,
172
+ composed: !0
173
+ })
174
+ );
175
+ }
176
+ };
177
+ i([
178
+ s({ type: String })
179
+ ], t.prototype, "uid", 2);
180
+ i([
181
+ s({ type: String })
182
+ ], t.prototype, "label", 2);
183
+ i([
184
+ s({ type: String })
185
+ ], t.prototype, "hint", 2);
186
+ i([
187
+ s({ type: String })
188
+ ], t.prototype, "icon", 2);
189
+ i([
190
+ s({ type: Array })
191
+ ], t.prototype, "errors", 2);
192
+ i([
193
+ s({ type: Boolean })
194
+ ], t.prototype, "showErrors", 2);
195
+ i([
196
+ s({ type: Boolean })
197
+ ], t.prototype, "touched", 2);
198
+ i([
199
+ s({ type: Boolean })
200
+ ], t.prototype, "required", 2);
201
+ i([
202
+ s({ type: Boolean })
203
+ ], t.prototype, "disabled", 2);
204
+ i([
205
+ s({ type: Boolean, attribute: "readonly" })
206
+ ], t.prototype, "readOnly", 2);
207
+ i([
208
+ s({ type: String, attribute: "locale-id" })
209
+ ], t.prototype, "localeId", 2);
210
+ i([
211
+ s({ type: String })
212
+ ], t.prototype, "value", 2);
213
+ i([
214
+ s({ type: String, attribute: "hour-format" })
215
+ ], t.prototype, "hourFormat", 2);
216
+ i([
217
+ s({ type: Number, attribute: "minute-step" })
218
+ ], t.prototype, "minuteStep", 2);
219
+ i([
220
+ s({ type: String, attribute: "min-time" })
221
+ ], t.prototype, "minTime", 2);
222
+ i([
223
+ s({ type: String, attribute: "max-time" })
224
+ ], t.prototype, "maxTime", 2);
225
+ i([
226
+ s({ type: Array, attribute: "disabled-ranges" })
227
+ ], t.prototype, "disabledRanges", 2);
228
+ i([
229
+ s({ type: Boolean, attribute: "allow-custom-time" })
230
+ ], t.prototype, "allowCustomTime", 2);
231
+ i([
232
+ s({ type: Number })
233
+ ], t.prototype, "height", 2);
234
+ i([
235
+ s({ type: Number, attribute: "item-height" })
236
+ ], t.prototype, "itemHeight", 2);
237
+ i([
238
+ s({ type: Number })
239
+ ], t.prototype, "columns", 2);
240
+ i([
241
+ s({ type: String, attribute: "min-time-message" })
242
+ ], t.prototype, "minTimeMessage", 2);
243
+ i([
244
+ s({ type: String, attribute: "max-time-message" })
245
+ ], t.prototype, "maxTimeMessage", 2);
246
+ i([
247
+ s({ type: String, attribute: "disabled-range-message" })
248
+ ], t.prototype, "disabledRangeMessage", 2);
249
+ i([
250
+ s({ type: String, attribute: "no-available-times-message" })
251
+ ], t.prototype, "noAvailableTimesMessage", 2);
252
+ i([
253
+ p("gui-time")
254
+ ], t.prototype, "_timeRef", 2);
255
+ i([
256
+ p("gui-time-list")
257
+ ], t.prototype, "_listRef", 2);
258
+ t = i([
259
+ d("gui-time-picker")
260
+ ], t);
261
+ typeof customElements < "u" && !customElements.get("gui-time-picker") && customElements.define("gui-time-picker", t);
@@ -0,0 +1,85 @@
1
+ import { InputWidgetAdapter as d, formContext as p, inputContext as m } from "@golemui/lit";
2
+ import "./time-picker-bFJ63ky8.js";
3
+ import { consume as u, provide as c } from "@lit/context";
4
+ import { LitElement as h, html as g } from "lit";
5
+ import { property as $, customElement as b } from "lit/decorators.js";
6
+ import "rxjs";
7
+ var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (e, t, r, a) => {
8
+ for (var i = a > 1 ? void 0 : a ? v(t, r) : t, n = e.length - 1, o; n >= 0; n--)
9
+ (o = e[n]) && (i = (a ? o(t, r, i) : o(i)) || i);
10
+ return a && i && f(t, r, i), i;
11
+ };
12
+ let s = class extends h {
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
+ .hourFormat=${e.hourFormat}
46
+ .minuteStep=${e.minuteStep}
47
+ .minTime=${e.minTime}
48
+ .maxTime=${e.maxTime}
49
+ .disabledRanges=${e.disabledRanges}
50
+ ?allow-custom-time=${e.allowCustomTime}
51
+ .height=${e.height}
52
+ .itemHeight=${e.itemHeight}
53
+ .minTimeMessage=${e.minTimeMessage}
54
+ .maxTimeMessage=${e.maxTimeMessage}
55
+ .disabledRangeMessage=${e.disabledRangeMessage}
56
+ .noAvailableTimesMessage=${e.noAvailableTimesMessage}
57
+ @inputError=${this.onInputError}
58
+ @blur=${() => this.adapter.onBlur()}
59
+ @change=${this.valueChanged}
60
+ ></gui-time-picker>
61
+ `;
62
+ }
63
+ valueChanged(e) {
64
+ this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
65
+ }
66
+ onInputError(e) {
67
+ this.adapter.injectValidationIssues([e.detail.message]);
68
+ }
69
+ disconnectedCallback() {
70
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
71
+ }
72
+ };
73
+ l([
74
+ u({ context: p }),
75
+ $({ attribute: !1 })
76
+ ], s.prototype, "formContext", 2);
77
+ l([
78
+ c({ context: m })
79
+ ], s.prototype, "adapter", 2);
80
+ s = l([
81
+ b("gui-time-picker-input")
82
+ ], s);
83
+ export {
84
+ s as TimePickerElement
85
+ };
@@ -0,0 +1,82 @@
1
+ import { InputWidgetAdapter as l, formContext as m, inputContext as n } from "@golemui/lit";
2
+ import { a as u } from "./templates-Dk1jxLwS.js";
3
+ import "./time-input-BOhlBGJZ.js";
4
+ import { consume as h, provide as c } from "@lit/context";
5
+ import { LitElement as g, html as $ } from "lit";
6
+ import { property as D, customElement as f } from "lit/decorators.js";
7
+ import "rxjs";
8
+ import { classMap as b } from "lit/directives/class-map.js";
9
+ var v = Object.defineProperty, x = Object.getOwnPropertyDescriptor, d = (t, e, s, i) => {
10
+ for (var a = i > 1 ? void 0 : i ? x(e, s) : e, p = t.length - 1, o; p >= 0; p--)
11
+ (o = t[p]) && (a = (i ? o(e, s, a) : o(a)) || a);
12
+ return i && a && v(e, s, a), a;
13
+ };
14
+ let r = class extends g {
15
+ constructor() {
16
+ super(...arguments), this.adapter = new l(), 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 = u("time", this.adapter.templateData);
34
+ return $`
35
+ <gui-time
36
+ class=${b(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
+ .hourFormat=${this.adapter.templateData.hourFormat}
49
+ .minuteStep=${this.adapter.templateData.minuteStep}
50
+ .minTime=${this.adapter.templateData.minTime}
51
+ .maxTime=${this.adapter.templateData.maxTime}
52
+ .minTimeMessage=${this.adapter.templateData.minTimeMessage}
53
+ .maxTimeMessage=${this.adapter.templateData.maxTimeMessage}
54
+ @inputError=${this.onInputError}
55
+ @blur=${() => this.adapter.onBlur()}
56
+ @change=${this.valueChanged}
57
+ ></gui-time>
58
+ `;
59
+ }
60
+ valueChanged(t) {
61
+ this.adapter.injectValidationIssues(null), this.adapter.valueChanged(t.detail.value);
62
+ }
63
+ onInputError(t) {
64
+ this.adapter.injectValidationIssues([t.detail.message]);
65
+ }
66
+ disconnectedCallback() {
67
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
68
+ }
69
+ };
70
+ d([
71
+ h({ context: m }),
72
+ D({ attribute: !1 })
73
+ ], r.prototype, "formContext", 2);
74
+ d([
75
+ c({ context: n })
76
+ ], r.prototype, "adapter", 2);
77
+ r = d([
78
+ f("gui-time-input")
79
+ ], r);
80
+ export {
81
+ r as TimeElement
82
+ };