@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,357 @@
1
+ import { InputWidgetAdapter as g, formContext as m, inputContext as y } from "@golemui/lit";
2
+ import { LitElement as c, html as h, nothing as $ } from "lit";
3
+ import { property as a, customElement as b } from "lit/decorators.js";
4
+ import { classMap as v } from "lit/directives/class-map.js";
5
+ import "./date-input-DLiMreSS.js";
6
+ import "./calendar-D31xNsxx.js";
7
+ import { G as M } from "./popup.controller-B33OvX_y.js";
8
+ import { d as f } from "./date-DBuYpvcO.js";
9
+ import { a as A, b as D, c as L } from "./templates-Dmr34nwp.js";
10
+ import { consume as x, provide as w } from "@lit/context";
11
+ import "rxjs";
12
+ var _ = Object.defineProperty, C = Object.getOwnPropertyDescriptor, i = (e, r, n, s) => {
13
+ for (var o = s > 1 ? void 0 : s ? C(r, n) : r, l = e.length - 1, d; l >= 0; l--)
14
+ (d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
15
+ return s && o && _(r, n, o), o;
16
+ };
17
+ let t = class extends c {
18
+ constructor() {
19
+ super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.toggleAriaLabel = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = 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.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.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = void 0, this.invalidDateMessage = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.disabledDateRangeMessage = void 0, this._popup = new M(this, {
20
+ focusRestoreSelector: "gui-date input",
21
+ focusPopupSelector: '.gui-calendar__day-button[tabindex="0"]',
22
+ isDisabled: () => !!this.disabled,
23
+ clickIntent: (e) => e.closest(".gui-calendar__day-button") ? "ignore" : e.closest(".gui-date-input__part") || e.closest("gui-calendar") ? "open" : "toggle",
24
+ keyToggleMode: "toggle"
25
+ }), this.onToggleClick = (e) => {
26
+ e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
27
+ };
28
+ }
29
+ createRenderRoot() {
30
+ return this;
31
+ }
32
+ render() {
33
+ const e = A("datePicker", { icon: this.icon }), r = this._popup.open ? h`<gui-calendar
34
+ id=${`${this.uid}_popup`}
35
+ role="dialog"
36
+ aria-label=${this.label ?? "Calendar"}
37
+ .uid=${this.uid}
38
+ .hint=${this.hint}
39
+ ?touched=${this.touched}
40
+ ?required=${this.required}
41
+ ?disabled=${this.disabled}
42
+ ?readonly=${this.readOnly}
43
+ .value=${this.value}
44
+ .prevMonthIcon=${this.prevMonthIcon}
45
+ .nextMonthIcon=${this.nextMonthIcon}
46
+ .prevMonthAriaLabel=${this.prevMonthAriaLabel}
47
+ .nextMonthAriaLabel=${this.nextMonthAriaLabel}
48
+ .selectYearAriaLabel=${this.selectYearAriaLabel}
49
+ .yearGridAriaLabel=${this.yearGridAriaLabel}
50
+ .dayFormat=${this.dayFormat}
51
+ .weekdayFormat=${this.weekdayFormat}
52
+ .monthFormat=${this.monthFormat}
53
+ .minDate=${this.minDate}
54
+ .maxDate=${this.maxDate}
55
+ .disabledRanges=${this.disabledRanges}
56
+ .numberOfMonths=${this.numberOfMonths}
57
+ .localeId=${this.localeId}
58
+ @blur=${this.onCalendarBlur}
59
+ @change=${this.onCalendarChange}
60
+ ></gui-calendar>` : $;
61
+ return h`
62
+ ${D(
63
+ this.uid ?? "",
64
+ {
65
+ label: this.label,
66
+ hint: this.hint,
67
+ required: this.required
68
+ },
69
+ !1,
70
+ void 0,
71
+ !1
72
+ )}
73
+
74
+ <div
75
+ class="gui-widget"
76
+ @keydown=${this._popup.onAnchorKeyDown}
77
+ @click=${this._popup.onAnchorClick}
78
+ >
79
+ <gui-date
80
+ id="date-input"
81
+ class=${v(e.widgetClasses)}
82
+ .uid=${this.uid}
83
+ .hint=${this.hint}
84
+ .showErrors=${!1}
85
+ .errors=${this.errors}
86
+ ?touched=${this.touched}
87
+ ?required=${this.required}
88
+ ?disabled=${this.disabled}
89
+ ?readonly=${this.readOnly}
90
+ .value=${this.value}
91
+ .icon=${this.icon}
92
+ .localeId=${this.localeId}
93
+ .dayAriaLabel=${this.dayAriaLabel}
94
+ .monthAriaLabel=${this.monthAriaLabel}
95
+ .yearAriaLabel=${this.yearAriaLabel}
96
+ .invalidDateMessage=${this.invalidDateMessage}
97
+ @blur=${this.onDateBlur}
98
+ @focus=${this._popup.show}
99
+ @change=${this.onDateChange}
100
+ ></gui-date>
101
+ <button
102
+ type="button"
103
+ class="gui-date-picker__arrow"
104
+ aria-label=${this.toggleAriaLabel ?? "Show calendar"}
105
+ aria-haspopup="dialog"
106
+ aria-expanded=${this._popup.open ? "true" : "false"}
107
+ aria-controls=${`${this.uid}_popup`}
108
+ ?disabled=${this.disabled}
109
+ @click=${this.onToggleClick}
110
+ >
111
+ <svg
112
+ xmlns="http://www.w3.org/2000/svg"
113
+ width="16"
114
+ height="16"
115
+ viewBox="0 0 256 256"
116
+ aria-hidden="true"
117
+ >
118
+ <path
119
+ 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"
120
+ ></path>
121
+ </svg>
122
+ </button>
123
+
124
+ ${r}
125
+ </div>
126
+
127
+ ${this.showErrors ? L(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
128
+ `;
129
+ }
130
+ onDateChange(e) {
131
+ e.stopPropagation(), this.commitValue(e.detail.value);
132
+ }
133
+ onDateBlur() {
134
+ this.dispatchEvent(new CustomEvent("blur"));
135
+ }
136
+ onCalendarChange(e) {
137
+ e.stopPropagation(), this.commitValue(e.detail.value), this._popup.close();
138
+ }
139
+ commitValue(e) {
140
+ this.value = e ?? void 0;
141
+ const r = this.validateBounds(this.value);
142
+ this.dispatchEvent(
143
+ new CustomEvent("change", {
144
+ detail: { value: e ?? null },
145
+ bubbles: !0,
146
+ composed: !0
147
+ })
148
+ ), r && this.dispatchEvent(
149
+ new CustomEvent("inputError", {
150
+ detail: { message: r },
151
+ bubbles: !0,
152
+ composed: !0
153
+ })
154
+ );
155
+ }
156
+ validateBounds(e) {
157
+ return e ? f(e, this.minDate, this.maxDate, this.disabledRanges, {
158
+ minDateMessage: this.minDateMessage,
159
+ maxDateMessage: this.maxDateMessage,
160
+ disabledDateRangeMessage: this.disabledDateRangeMessage
161
+ }) : null;
162
+ }
163
+ onCalendarBlur() {
164
+ this._popup.closeOnFocusLeave();
165
+ }
166
+ };
167
+ i([
168
+ a({ type: String })
169
+ ], t.prototype, "uid", 2);
170
+ i([
171
+ a({ type: String })
172
+ ], t.prototype, "label", 2);
173
+ i([
174
+ a({ type: String })
175
+ ], t.prototype, "hint", 2);
176
+ i([
177
+ a({ type: String })
178
+ ], t.prototype, "icon", 2);
179
+ i([
180
+ a({ type: String, attribute: "toggle-aria-label" })
181
+ ], t.prototype, "toggleAriaLabel", 2);
182
+ i([
183
+ a({ type: String })
184
+ ], t.prototype, "dayAriaLabel", 2);
185
+ i([
186
+ a({ type: String })
187
+ ], t.prototype, "monthAriaLabel", 2);
188
+ i([
189
+ a({ type: String })
190
+ ], t.prototype, "yearAriaLabel", 2);
191
+ i([
192
+ a({ type: Array })
193
+ ], t.prototype, "errors", 2);
194
+ i([
195
+ a({ type: Boolean })
196
+ ], t.prototype, "showErrors", 2);
197
+ i([
198
+ a({ type: Boolean })
199
+ ], t.prototype, "touched", 2);
200
+ i([
201
+ a({ type: Boolean })
202
+ ], t.prototype, "required", 2);
203
+ i([
204
+ a({ type: Boolean })
205
+ ], t.prototype, "disabled", 2);
206
+ i([
207
+ a({ type: Boolean, attribute: "readonly" })
208
+ ], t.prototype, "readOnly", 2);
209
+ i([
210
+ a({ type: String, attribute: "locale-id" })
211
+ ], t.prototype, "localeId", 2);
212
+ i([
213
+ a({ type: String })
214
+ ], t.prototype, "value", 2);
215
+ i([
216
+ a({ type: String, attribute: "prev-month-icon" })
217
+ ], t.prototype, "prevMonthIcon", 2);
218
+ i([
219
+ a({ type: String, attribute: "next-month-icon" })
220
+ ], t.prototype, "nextMonthIcon", 2);
221
+ i([
222
+ a({ type: String, attribute: "prev-month-aria-label" })
223
+ ], t.prototype, "prevMonthAriaLabel", 2);
224
+ i([
225
+ a({ type: String, attribute: "next-month-aria-label" })
226
+ ], t.prototype, "nextMonthAriaLabel", 2);
227
+ i([
228
+ a({ type: String, attribute: "select-year-aria-label" })
229
+ ], t.prototype, "selectYearAriaLabel", 2);
230
+ i([
231
+ a({ type: String, attribute: "year-grid-aria-label" })
232
+ ], t.prototype, "yearGridAriaLabel", 2);
233
+ i([
234
+ a({ type: String, attribute: "day-format" })
235
+ ], t.prototype, "dayFormat", 2);
236
+ i([
237
+ a({ type: String, attribute: "weekday-format" })
238
+ ], t.prototype, "weekdayFormat", 2);
239
+ i([
240
+ a({ type: String, attribute: "month-format" })
241
+ ], t.prototype, "monthFormat", 2);
242
+ i([
243
+ a({ type: String, attribute: "min-date" })
244
+ ], t.prototype, "minDate", 2);
245
+ i([
246
+ a({ type: String, attribute: "max-date" })
247
+ ], t.prototype, "maxDate", 2);
248
+ i([
249
+ a({ type: Array, attribute: "disabled-ranges" })
250
+ ], t.prototype, "disabledRanges", 2);
251
+ i([
252
+ a({ type: Number, attribute: "number-of-months" })
253
+ ], t.prototype, "numberOfMonths", 2);
254
+ i([
255
+ a({ type: String, attribute: "invalid-date-message" })
256
+ ], t.prototype, "invalidDateMessage", 2);
257
+ i([
258
+ a({ type: String, attribute: "min-date-message" })
259
+ ], t.prototype, "minDateMessage", 2);
260
+ i([
261
+ a({ type: String, attribute: "max-date-message" })
262
+ ], t.prototype, "maxDateMessage", 2);
263
+ i([
264
+ a({ type: String, attribute: "disabled-date-range-message" })
265
+ ], t.prototype, "disabledDateRangeMessage", 2);
266
+ t = i([
267
+ b("gui-date-picker")
268
+ ], t);
269
+ typeof customElements < "u" && !customElements.get("gui-date-picker") && customElements.define("gui-date-picker", t);
270
+ var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, u = (e, r, n, s) => {
271
+ for (var o = s > 1 ? void 0 : s ? I(r, n) : r, l = e.length - 1, d; l >= 0; l--)
272
+ (d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
273
+ return s && o && S(r, n, o), o;
274
+ };
275
+ let p = class extends c {
276
+ constructor() {
277
+ super(...arguments), this.adapter = new g(), this.subscriptions = [];
278
+ }
279
+ createRenderRoot() {
280
+ return this;
281
+ }
282
+ updated(e) {
283
+ super.updated(e);
284
+ const r = this.adapter.templateData.size;
285
+ r ? this.style.flex = String(r) : this.style.removeProperty("flex");
286
+ }
287
+ connectedCallback() {
288
+ super.connectedCallback(), this.classList.add("gui-date-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
289
+ this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
290
+ );
291
+ }
292
+ render() {
293
+ super.render();
294
+ const e = this.adapter.templateData;
295
+ return h`
296
+ <gui-date-picker
297
+ .uid=${this.widget.uid}
298
+ .label=${e.label}
299
+ .hint=${e.hint}
300
+ .errors=${e.errors}
301
+ ?touched=${e.touched}
302
+ ?required=${e.validator?.required}
303
+ ?disabled=${e.disabled}
304
+ ?readonly=${e.readonly}
305
+ .value=${e.value}
306
+ .icon=${e.icon}
307
+ .localeId=${e.lang}
308
+ .toggleAriaLabel=${e.toggleAriaLabel}
309
+ .dayAriaLabel=${e.dayAriaLabel}
310
+ .monthAriaLabel=${e.monthAriaLabel}
311
+ .yearAriaLabel=${e.yearAriaLabel}
312
+ .prevMonthIcon=${e.prevMonthIcon}
313
+ .nextMonthIcon=${e.nextMonthIcon}
314
+ .prevMonthAriaLabel=${e.prevMonthAriaLabel}
315
+ .nextMonthAriaLabel=${e.nextMonthAriaLabel}
316
+ .selectYearAriaLabel=${e.selectYearAriaLabel}
317
+ .yearGridAriaLabel=${e.yearGridAriaLabel}
318
+ .dayFormat=${e.dayFormat}
319
+ .weekdayFormat=${e.weekdayFormat}
320
+ .monthFormat=${e.monthFormat}
321
+ .minDate=${e.minDate}
322
+ .maxDate=${e.maxDate}
323
+ .disabledRanges=${e.disabledRanges}
324
+ .numberOfMonths=${e.numberOfMonths}
325
+ .invalidDateMessage=${e.invalidDateMessage}
326
+ .minDateMessage=${e.minDateMessage}
327
+ .maxDateMessage=${e.maxDateMessage}
328
+ .disabledDateRangeMessage=${e.disabledDateRangeMessage}
329
+ @inputError=${this.onInputError}
330
+ @blur=${() => this.adapter.onBlur()}
331
+ @change=${this.valueChanged}
332
+ ></gui-date-picker>
333
+ `;
334
+ }
335
+ valueChanged(e) {
336
+ this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
337
+ }
338
+ onInputError(e) {
339
+ this.adapter.injectValidationIssues([e.detail.message]);
340
+ }
341
+ disconnectedCallback() {
342
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
343
+ }
344
+ };
345
+ u([
346
+ x({ context: m }),
347
+ a({ attribute: !1 })
348
+ ], p.prototype, "formContext", 2);
349
+ u([
350
+ w({ context: y })
351
+ ], p.prototype, "adapter", 2);
352
+ p = u([
353
+ b("gui-date-picker-input")
354
+ ], p);
355
+ export {
356
+ p as DatePickerElement
357
+ };