@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.
Files changed (83) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
  3. package/calendar-D31xNsxx.js +267 -0
  4. package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
  5. package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
  6. package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
  7. package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
  8. package/date-input-DLiMreSS.js +204 -0
  9. package/date-picker.element-DeUQtbLg.js +357 -0
  10. package/date-time-calendar-DzU-FtVl.js +374 -0
  11. package/date-time-calendar.element-BLBcVsFu.js +95 -0
  12. package/date-time-input-DZaz2heD.js +246 -0
  13. package/date-time-picker.element-BUbLdV6i.js +440 -0
  14. package/date-time.element-B5onfSBG.js +93 -0
  15. package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
  16. package/day-status-CsWStVQV.js +554 -0
  17. package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
  18. package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
  19. package/focus-leave.controller-2gV0pQd5.js +73 -0
  20. package/index.js +1635 -948
  21. package/index.umd.cjs +2046 -601
  22. package/lib/components/date-picker.element.d.ts +0 -11
  23. package/lib/components/date-time-calendar.element.d.ts +18 -0
  24. package/lib/components/date-time-picker.element.d.ts +18 -0
  25. package/lib/components/date-time.element.d.ts +18 -0
  26. package/lib/components/dropdown.element.d.ts +2 -0
  27. package/lib/components/range-calendar.element.d.ts +2 -1
  28. package/lib/components/range-date-picker.element.d.ts +0 -15
  29. package/lib/components/range-date-time-calendar.element.d.ts +18 -0
  30. package/lib/components/range-date-time-input.element.d.ts +18 -0
  31. package/lib/components/range-date-time-picker.element.d.ts +18 -0
  32. package/lib/components/range-time-input.element.d.ts +18 -0
  33. package/lib/components/range-time-picker.element.d.ts +18 -0
  34. package/lib/components/time-picker.element.d.ts +18 -0
  35. package/lib/components/time.element.d.ts +18 -0
  36. package/list-D730tmGN.js +297 -0
  37. package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
  38. package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
  39. package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
  40. package/package.json +6 -6
  41. package/part-templates-VORbpgs2.js +691 -0
  42. package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
  43. package/pill-ranges-DpvWwP-3.js +48 -0
  44. package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
  45. package/popup.controller-B33OvX_y.js +86 -0
  46. package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
  47. package/range-calendar-DO_woqcF.js +466 -0
  48. package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
  49. package/range-commit-8-MmYUyo.js +14 -0
  50. package/range-date-input-Br7XqQPK.js +311 -0
  51. package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
  52. package/range-date-picker.element-DWRHiAoC.js +434 -0
  53. package/range-date-time-calendar-B3EMgN1E.js +734 -0
  54. package/range-date-time-calendar.element-Coea6RF4.js +97 -0
  55. package/range-date-time-input-Cu-T_nuC.js +353 -0
  56. package/range-date-time-input.element-Cti44iuW.js +87 -0
  57. package/range-date-time-picker.element-CDN2RL1y.js +472 -0
  58. package/range-selection-CU3hxLJE.js +25 -0
  59. package/range-time-input-BP9ZL9O8.js +348 -0
  60. package/range-time-input.element-B7wtHJoQ.js +84 -0
  61. package/range-time-picker.element-CPIAiQPC.js +470 -0
  62. package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
  63. package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
  64. package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
  65. package/{tags.element-CX3vQL8L.js → tags.element-CPHgotb0.js} +21 -14
  66. package/templates-Dmr34nwp.js +88 -0
  67. package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
  68. package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
  69. package/time-input-5dkSm8UW.js +201 -0
  70. package/time-list-DLcq8BAp.js +217 -0
  71. package/time-picker-g337F8d0.js +299 -0
  72. package/time-picker.element-DLihegjg.js +89 -0
  73. package/time.element-BneqgMlQ.js +85 -0
  74. package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
  75. package/abstract-calendar-D0-077XJ.js +0 -545
  76. package/calendar-BclCC9VJ.js +0 -96
  77. package/date-input-DCdGWRio.js +0 -268
  78. package/date-picker.element-k7AJFQ5W.js +0 -168
  79. package/list-D1oKnH89.js +0 -283
  80. package/range-calendar-CBINu84w.js +0 -255
  81. package/range-date-input-BYXzqnr1.js +0 -395
  82. package/range-date-picker.element-BCBefgvY.js +0 -182
  83. package/templates-Dk1jxLwS.js +0 -75
@@ -0,0 +1,472 @@
1
+ import { InputWidgetAdapter as g, formContext as c, inputContext as y } from "@golemui/lit";
2
+ import { LitElement as m, html as h, nothing as $ } from "lit";
3
+ import { property as i, state as v, customElement as b } from "lit/decorators.js";
4
+ import { classMap as L } from "lit/directives/class-map.js";
5
+ import "./range-date-time-input-Cu-T_nuC.js";
6
+ import "./range-date-time-calendar-B3EMgN1E.js";
7
+ import { G as A } from "./popup.controller-B33OvX_y.js";
8
+ import { a as D, b as T, c as f } from "./templates-Dmr34nwp.js";
9
+ import { consume as M, provide as C } from "@lit/context";
10
+ import "rxjs";
11
+ var w = Object.defineProperty, S = Object.getOwnPropertyDescriptor, a = (e, r, n, s) => {
12
+ for (var o = s > 1 ? void 0 : s ? S(r, n) : r, l = e.length - 1, d; l >= 0; l--)
13
+ (d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
14
+ return s && o && w(r, n, o), o;
15
+ };
16
+ let t = class extends m {
17
+ constructor() {
18
+ 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 = [], this.toggleAriaLabel = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.separator = void 0, this.removePillAriaLabel = void 0, this.startDateTimeAriaLabel = void 0, this.endDateTimeAriaLabel = void 0, this.invalidDateMessage = void 0, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = void 0, this.nextMonthAriaLabel = void 0, this.selectYearAriaLabel = void 0, this.yearGridAriaLabel = void 0, this.dayFormat = void 0, this.weekdayFormat = void 0, this.monthFormat = void 0, this.numberOfMonths = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.allowCustomTime = !1, this.startTimeLabel = void 0, this.endTimeLabel = void 0, this.minDateTime = void 0, this.maxDateTime = void 0, this.minDateTimeMessage = void 0, this.maxDateTimeMessage = void 0, this.disabledRanges = void 0, this.disabledRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this.dayCountAriaLabel = void 0, this.disabledDayCountAriaLabel = void 0, this._focusDate = void 0, this._popup = new A(this, {
19
+ focusRestoreSelector: "gui-range-date-time input",
20
+ focusPopupSelector: '.gui-calendar__day-button[tabindex="0"]',
21
+ isDisabled: () => !!this.disabled,
22
+ clickIntent: (e) => e.closest(".gui-calendar__day-button") || e.closest(".gui-time-list__option") || e.closest("gui-time-picker") ? "ignore" : e.closest(".gui-range-date-time-input__field") || e.closest("gui-range-date-time-calendar") ? "open" : "toggle",
23
+ keyToggleMode: "openClose",
24
+ beforeOpen: (e) => {
25
+ this.querySelector(".gui-pills__dropdown") && e.suppressNextFocusOut(), this.closePillsDropdown();
26
+ },
27
+ onOpenChanged: (e) => {
28
+ e || (this._focusDate = void 0);
29
+ }
30
+ }), this.onDropdownToggle = (e) => {
31
+ e.detail?.open && this._popup.open && this._popup.close();
32
+ }, this.onToggleClick = (e) => {
33
+ e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
34
+ };
35
+ }
36
+ createRenderRoot() {
37
+ return this;
38
+ }
39
+ connectedCallback() {
40
+ super.connectedCallback(), this.addEventListener("dropdowntoggle", this.onDropdownToggle);
41
+ }
42
+ disconnectedCallback() {
43
+ super.disconnectedCallback(), this.removeEventListener("dropdowntoggle", this.onDropdownToggle);
44
+ }
45
+ render() {
46
+ const e = D("datePicker", { icon: this.icon }), r = this._popup.open ? h`<gui-range-date-time-calendar
47
+ id=${`${this.uid}_popup`}
48
+ role="dialog"
49
+ aria-label=${this.label ?? "Calendar"}
50
+ .uid=${this.uid}
51
+ .hint=${this.hint}
52
+ ?touched=${this.touched}
53
+ ?required=${this.required}
54
+ ?disabled=${this.disabled}
55
+ ?readonly=${this.readOnly}
56
+ .value=${this.value}
57
+ .focusDate=${this._focusDate}
58
+ .hidePills=${!0}
59
+ .localeId=${this.localeId}
60
+ .prevMonthIcon=${this.prevMonthIcon}
61
+ .nextMonthIcon=${this.nextMonthIcon}
62
+ .prevMonthAriaLabel=${this.prevMonthAriaLabel}
63
+ .nextMonthAriaLabel=${this.nextMonthAriaLabel}
64
+ .selectYearAriaLabel=${this.selectYearAriaLabel}
65
+ .yearGridAriaLabel=${this.yearGridAriaLabel}
66
+ .dayFormat=${this.dayFormat}
67
+ .weekdayFormat=${this.weekdayFormat}
68
+ .monthFormat=${this.monthFormat}
69
+ .numberOfMonths=${this.numberOfMonths}
70
+ .hourFormat=${this.hourFormat}
71
+ .minuteStep=${this.minuteStep}
72
+ .allowCustomTime=${this.allowCustomTime}
73
+ .startTimeLabel=${this.startTimeLabel}
74
+ .endTimeLabel=${this.endTimeLabel}
75
+ .minDateTime=${this.minDateTime}
76
+ .maxDateTime=${this.maxDateTime}
77
+ .minDateTimeMessage=${this.minDateTimeMessage}
78
+ .maxDateTimeMessage=${this.maxDateTimeMessage}
79
+ .disabledRanges=${this.disabledRanges}
80
+ .disabledRangeMessage=${this.disabledRangeMessage}
81
+ .noAvailableTimesMessage=${this.noAvailableTimesMessage}
82
+ .dayCountAriaLabel=${this.dayCountAriaLabel}
83
+ .disabledDayCountAriaLabel=${this.disabledDayCountAriaLabel}
84
+ @blur=${this.onCalendarBlur}
85
+ @change=${this.onCalendarChange}
86
+ @inputError=${this.onCalendarInputError}
87
+ ></gui-range-date-time-calendar>` : $;
88
+ return h`
89
+ ${T(
90
+ this.uid ?? "",
91
+ {
92
+ label: this.label,
93
+ hint: this.hint,
94
+ required: this.required
95
+ },
96
+ !1,
97
+ void 0,
98
+ !1
99
+ )}
100
+
101
+ <div
102
+ class="gui-widget"
103
+ @keydown=${this._popup.onAnchorKeyDown}
104
+ @click=${this._popup.onAnchorClick}
105
+ >
106
+ <gui-range-date-time
107
+ id="date-input"
108
+ class=${L(e.widgetClasses)}
109
+ .uid=${this.uid}
110
+ .hint=${this.hint}
111
+ .showErrors=${!1}
112
+ .errors=${this.errors}
113
+ ?touched=${this.touched}
114
+ ?required=${this.required}
115
+ ?disabled=${this.disabled}
116
+ ?readonly=${this.readOnly}
117
+ .value=${this.value}
118
+ .icon=${this.icon}
119
+ .localeId=${this.localeId}
120
+ .hourFormat=${this.hourFormat}
121
+ .minuteStep=${this.minuteStep}
122
+ .separator=${this.separator}
123
+ .removePillAriaLabel=${this.removePillAriaLabel}
124
+ .startDateTimeAriaLabel=${this.startDateTimeAriaLabel}
125
+ .endDateTimeAriaLabel=${this.endDateTimeAriaLabel}
126
+ .dayAriaLabel=${this.dayAriaLabel}
127
+ .monthAriaLabel=${this.monthAriaLabel}
128
+ .yearAriaLabel=${this.yearAriaLabel}
129
+ .hourAriaLabel=${this.hourAriaLabel}
130
+ .minuteAriaLabel=${this.minuteAriaLabel}
131
+ .dayPeriodAriaLabel=${this.dayPeriodAriaLabel}
132
+ .invalidDateMessage=${this.invalidDateMessage}
133
+ .minDateTime=${this.minDateTime}
134
+ .maxDateTime=${this.maxDateTime}
135
+ .minDateTimeMessage=${this.minDateTimeMessage}
136
+ .maxDateTimeMessage=${this.maxDateTimeMessage}
137
+ .disabledRanges=${this.disabledRanges}
138
+ .disabledRangeMessage=${this.disabledRangeMessage}
139
+ @blur=${this.onDateBlur}
140
+ @focus=${this._popup.show}
141
+ @change=${this.onDateChange}
142
+ @pillClick=${this.onPillClick}
143
+ ></gui-range-date-time>
144
+ <button
145
+ type="button"
146
+ class="gui-range-date-time-picker__arrow"
147
+ aria-label=${this.toggleAriaLabel ?? "Show calendar"}
148
+ aria-haspopup="dialog"
149
+ aria-expanded=${this._popup.open ? "true" : "false"}
150
+ aria-controls=${`${this.uid}_popup`}
151
+ ?disabled=${this.disabled}
152
+ @click=${this.onToggleClick}
153
+ >
154
+ <svg
155
+ xmlns="http://www.w3.org/2000/svg"
156
+ width="16"
157
+ height="16"
158
+ viewBox="0 0 256 256"
159
+ aria-hidden="true"
160
+ >
161
+ <path
162
+ 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"
163
+ ></path>
164
+ </svg>
165
+ </button>
166
+
167
+ ${r}
168
+ </div>
169
+
170
+ ${this.showErrors ? f(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
171
+ `;
172
+ }
173
+ onDateChange(e) {
174
+ e.stopPropagation(), this.commitValue(e.detail.value);
175
+ }
176
+ onDateBlur() {
177
+ this.dispatchEvent(new CustomEvent("blur"));
178
+ }
179
+ onCalendarChange(e) {
180
+ if (!this._popup.open) {
181
+ e.stopPropagation();
182
+ return;
183
+ }
184
+ e.stopPropagation(), this.commitValue(e.detail.value), this._popup.suppressNextFocusOut(), requestAnimationFrame(() => {
185
+ if (!this._popup.open) return;
186
+ this.querySelector(
187
+ 'gui-range-date-time-calendar .gui-calendar__day-button[tabindex="0"]'
188
+ )?.focus();
189
+ });
190
+ }
191
+ onCalendarInputError(e) {
192
+ e.stopPropagation(), this.dispatchEvent(
193
+ new CustomEvent("inputError", {
194
+ detail: e.detail,
195
+ bubbles: !0,
196
+ composed: !0
197
+ })
198
+ );
199
+ }
200
+ commitValue(e) {
201
+ this.value = e ?? void 0, this.dispatchEvent(
202
+ new CustomEvent("change", {
203
+ detail: { value: e ?? null },
204
+ bubbles: !0,
205
+ composed: !0
206
+ })
207
+ );
208
+ }
209
+ onCalendarBlur() {
210
+ this._popup.closeOnFocusLeave();
211
+ }
212
+ onPillClick(e) {
213
+ this._focusDate = e.detail.range.start, this._popup.show();
214
+ }
215
+ closePillsDropdown() {
216
+ this.querySelector("gui-pills")?.closeDropdown?.();
217
+ }
218
+ };
219
+ a([
220
+ i({ type: String })
221
+ ], t.prototype, "uid", 2);
222
+ a([
223
+ i({ type: String })
224
+ ], t.prototype, "label", 2);
225
+ a([
226
+ i({ type: String })
227
+ ], t.prototype, "hint", 2);
228
+ a([
229
+ i({ type: String })
230
+ ], t.prototype, "icon", 2);
231
+ a([
232
+ i({ type: Array })
233
+ ], t.prototype, "errors", 2);
234
+ a([
235
+ i({ type: Boolean })
236
+ ], t.prototype, "showErrors", 2);
237
+ a([
238
+ i({ type: Boolean })
239
+ ], t.prototype, "touched", 2);
240
+ a([
241
+ i({ type: Boolean })
242
+ ], t.prototype, "required", 2);
243
+ a([
244
+ i({ type: Boolean })
245
+ ], t.prototype, "disabled", 2);
246
+ a([
247
+ i({ type: Boolean, attribute: "readonly" })
248
+ ], t.prototype, "readOnly", 2);
249
+ a([
250
+ i({ type: String, attribute: "locale-id" })
251
+ ], t.prototype, "localeId", 2);
252
+ a([
253
+ i({ type: Array })
254
+ ], t.prototype, "value", 2);
255
+ a([
256
+ i({ type: String, attribute: "toggle-aria-label" })
257
+ ], t.prototype, "toggleAriaLabel", 2);
258
+ a([
259
+ i({ type: String })
260
+ ], t.prototype, "dayAriaLabel", 2);
261
+ a([
262
+ i({ type: String })
263
+ ], t.prototype, "monthAriaLabel", 2);
264
+ a([
265
+ i({ type: String })
266
+ ], t.prototype, "yearAriaLabel", 2);
267
+ a([
268
+ i({ type: String })
269
+ ], t.prototype, "hourAriaLabel", 2);
270
+ a([
271
+ i({ type: String })
272
+ ], t.prototype, "minuteAriaLabel", 2);
273
+ a([
274
+ i({ type: String })
275
+ ], t.prototype, "dayPeriodAriaLabel", 2);
276
+ a([
277
+ i({ type: String })
278
+ ], t.prototype, "separator", 2);
279
+ a([
280
+ i({ type: String, attribute: "remove-pill-aria-label" })
281
+ ], t.prototype, "removePillAriaLabel", 2);
282
+ a([
283
+ i({ type: String, attribute: "start-date-time-aria-label" })
284
+ ], t.prototype, "startDateTimeAriaLabel", 2);
285
+ a([
286
+ i({ type: String, attribute: "end-date-time-aria-label" })
287
+ ], t.prototype, "endDateTimeAriaLabel", 2);
288
+ a([
289
+ i({ type: String, attribute: "invalid-date-message" })
290
+ ], t.prototype, "invalidDateMessage", 2);
291
+ a([
292
+ i({ type: String, attribute: "prev-month-icon" })
293
+ ], t.prototype, "prevMonthIcon", 2);
294
+ a([
295
+ i({ type: String, attribute: "next-month-icon" })
296
+ ], t.prototype, "nextMonthIcon", 2);
297
+ a([
298
+ i({ type: String, attribute: "prev-month-aria-label" })
299
+ ], t.prototype, "prevMonthAriaLabel", 2);
300
+ a([
301
+ i({ type: String, attribute: "next-month-aria-label" })
302
+ ], t.prototype, "nextMonthAriaLabel", 2);
303
+ a([
304
+ i({ type: String, attribute: "select-year-aria-label" })
305
+ ], t.prototype, "selectYearAriaLabel", 2);
306
+ a([
307
+ i({ type: String, attribute: "year-grid-aria-label" })
308
+ ], t.prototype, "yearGridAriaLabel", 2);
309
+ a([
310
+ i({ type: String, attribute: "day-format" })
311
+ ], t.prototype, "dayFormat", 2);
312
+ a([
313
+ i({ type: String, attribute: "weekday-format" })
314
+ ], t.prototype, "weekdayFormat", 2);
315
+ a([
316
+ i({ type: String, attribute: "month-format" })
317
+ ], t.prototype, "monthFormat", 2);
318
+ a([
319
+ i({ type: Number, attribute: "number-of-months" })
320
+ ], t.prototype, "numberOfMonths", 2);
321
+ a([
322
+ i({ type: String, attribute: "hour-format" })
323
+ ], t.prototype, "hourFormat", 2);
324
+ a([
325
+ i({ type: Number, attribute: "minute-step" })
326
+ ], t.prototype, "minuteStep", 2);
327
+ a([
328
+ i({ type: Boolean, attribute: "allow-custom-time" })
329
+ ], t.prototype, "allowCustomTime", 2);
330
+ a([
331
+ i({ type: String, attribute: "start-time-label" })
332
+ ], t.prototype, "startTimeLabel", 2);
333
+ a([
334
+ i({ type: String, attribute: "end-time-label" })
335
+ ], t.prototype, "endTimeLabel", 2);
336
+ a([
337
+ i({ type: String, attribute: "min-date-time" })
338
+ ], t.prototype, "minDateTime", 2);
339
+ a([
340
+ i({ type: String, attribute: "max-date-time" })
341
+ ], t.prototype, "maxDateTime", 2);
342
+ a([
343
+ i({ type: String, attribute: "min-date-time-message" })
344
+ ], t.prototype, "minDateTimeMessage", 2);
345
+ a([
346
+ i({ type: String, attribute: "max-date-time-message" })
347
+ ], t.prototype, "maxDateTimeMessage", 2);
348
+ a([
349
+ i({ type: Array, attribute: "disabled-ranges" })
350
+ ], t.prototype, "disabledRanges", 2);
351
+ a([
352
+ i({ type: String, attribute: "disabled-range-message" })
353
+ ], t.prototype, "disabledRangeMessage", 2);
354
+ a([
355
+ i({ type: String, attribute: "no-available-times-message" })
356
+ ], t.prototype, "noAvailableTimesMessage", 2);
357
+ a([
358
+ i({ type: String, attribute: "day-count-aria-label" })
359
+ ], t.prototype, "dayCountAriaLabel", 2);
360
+ a([
361
+ i({ type: String, attribute: "disabled-day-count-aria-label" })
362
+ ], t.prototype, "disabledDayCountAriaLabel", 2);
363
+ a([
364
+ v()
365
+ ], t.prototype, "_focusDate", 2);
366
+ t = a([
367
+ b("gui-range-date-time-picker")
368
+ ], t);
369
+ typeof customElements < "u" && !customElements.get("gui-range-date-time-picker") && customElements.define("gui-range-date-time-picker", t);
370
+ var x = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, u = (e, r, n, s) => {
371
+ for (var o = s > 1 ? void 0 : s ? _(r, n) : r, l = e.length - 1, d; l >= 0; l--)
372
+ (d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
373
+ return s && o && x(r, n, o), o;
374
+ };
375
+ let p = class extends m {
376
+ constructor() {
377
+ super(...arguments), this.adapter = new g(), this.subscriptions = [];
378
+ }
379
+ createRenderRoot() {
380
+ return this;
381
+ }
382
+ updated(e) {
383
+ super.updated(e);
384
+ const r = this.adapter.templateData.size;
385
+ r ? this.style.flex = String(r) : this.style.removeProperty("flex");
386
+ }
387
+ connectedCallback() {
388
+ super.connectedCallback(), this.classList.add("gui-range-date-time-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
389
+ this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
390
+ );
391
+ }
392
+ render() {
393
+ super.render();
394
+ const e = this.adapter.templateData;
395
+ return h`
396
+ <gui-range-date-time-picker
397
+ .uid=${this.widget.uid}
398
+ .label=${e.label}
399
+ .hint=${e.hint}
400
+ .icon=${e.icon}
401
+ .errors=${e.errors}
402
+ ?touched=${e.touched}
403
+ ?required=${e.validator?.required}
404
+ ?disabled=${e.disabled}
405
+ ?readonly=${e.readonly}
406
+ .value=${e.value}
407
+ .separator=${e.separator}
408
+ .removePillAriaLabel=${e.removePillAriaLabel}
409
+ .startDateTimeAriaLabel=${e.startDateTimeAriaLabel}
410
+ .endDateTimeAriaLabel=${e.endDateTimeAriaLabel}
411
+ .invalidDateMessage=${e.invalidDateMessage}
412
+ .prevMonthIcon=${e.prevMonthIcon}
413
+ .nextMonthIcon=${e.nextMonthIcon}
414
+ .prevMonthAriaLabel=${e.prevMonthAriaLabel}
415
+ .nextMonthAriaLabel=${e.nextMonthAriaLabel}
416
+ .selectYearAriaLabel=${e.selectYearAriaLabel}
417
+ .yearGridAriaLabel=${e.yearGridAriaLabel}
418
+ .dayFormat=${e.dayFormat}
419
+ .weekdayFormat=${e.weekdayFormat}
420
+ .monthFormat=${e.monthFormat}
421
+ .numberOfMonths=${e.numberOfMonths}
422
+ .localeId=${e.lang}
423
+ .toggleAriaLabel=${e.toggleAriaLabel}
424
+ .dayAriaLabel=${e.dayAriaLabel}
425
+ .monthAriaLabel=${e.monthAriaLabel}
426
+ .yearAriaLabel=${e.yearAriaLabel}
427
+ .hourAriaLabel=${e.hourAriaLabel}
428
+ .minuteAriaLabel=${e.minuteAriaLabel}
429
+ .dayPeriodAriaLabel=${e.dayPeriodAriaLabel}
430
+ .hourFormat=${e.hourFormat}
431
+ .minuteStep=${e.minuteStep}
432
+ ?allow-custom-time=${e.allowCustomTime}
433
+ .startTimeLabel=${e.startTimeLabel}
434
+ .endTimeLabel=${e.endTimeLabel}
435
+ .minDateTime=${e.minDateTime}
436
+ .maxDateTime=${e.maxDateTime}
437
+ .disabledRanges=${e.disabledRanges}
438
+ .minDateTimeMessage=${e.minDateTimeMessage}
439
+ .maxDateTimeMessage=${e.maxDateTimeMessage}
440
+ .disabledRangeMessage=${e.disabledRangeMessage}
441
+ .noAvailableTimesMessage=${e.noAvailableTimesMessage}
442
+ .dayCountAriaLabel=${e.dayCountAriaLabel}
443
+ .disabledDayCountAriaLabel=${e.disabledDayCountAriaLabel}
444
+ @change=${this.valueChanged}
445
+ @inputError=${this.onInputError}
446
+ @blur=${() => this.adapter.onBlur()}
447
+ ></gui-range-date-time-picker>
448
+ `;
449
+ }
450
+ valueChanged(e) {
451
+ this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
452
+ }
453
+ onInputError(e) {
454
+ this.adapter.injectValidationIssues([e.detail.message]), this.adapter.onBlur();
455
+ }
456
+ disconnectedCallback() {
457
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
458
+ }
459
+ };
460
+ u([
461
+ M({ context: c }),
462
+ i({ attribute: !1 })
463
+ ], p.prototype, "formContext", 2);
464
+ u([
465
+ C({ context: y })
466
+ ], p.prototype, "adapter", 2);
467
+ p = u([
468
+ b("gui-range-date-time-picker-input")
469
+ ], p);
470
+ export {
471
+ p as RangeDateTimePickerElement
472
+ };
@@ -0,0 +1,25 @@
1
+ function o() {
2
+ return { anchor: null, hover: null, selecting: !1 };
3
+ }
4
+ function i(r, e) {
5
+ switch (e.type) {
6
+ case "pick": {
7
+ if (!r.anchor)
8
+ return { state: { anchor: e.date, hover: r.hover, selecting: !0 } };
9
+ let n = r.anchor, c = e.date;
10
+ return e.date < n && (n = e.date, c = r.anchor), { state: o(), commit: { start: n, end: c } };
11
+ }
12
+ case "hover":
13
+ return r.selecting ? { state: { ...r, hover: e.date } } : { state: r };
14
+ case "reset":
15
+ return { state: o() };
16
+ }
17
+ }
18
+ function h(r) {
19
+ return !r.selecting || !r.hover || !r.anchor ? null : r.hover.getTime() > r.anchor.getTime() ? { start: r.anchor, end: r.hover } : { start: r.hover, end: r.anchor };
20
+ }
21
+ export {
22
+ o as i,
23
+ i as r,
24
+ h as s
25
+ };