@golemui/gui-lit 1.2.0 → 1.2.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 (91) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/{accordion.element-BIgxl5e9.js → accordion.element-C9GzfKrY.js} +29 -30
  3. package/alert.element-CHn49Yaf.js +55 -0
  4. package/button.element-C9fHivSw.js +59 -0
  5. package/{calendar.element-Cv3RBphf.js → calendar.element-XkojKTJk.js} +30 -31
  6. package/checkbox.element-DU_tVMXu.js +66 -0
  7. package/currency.element-BmAH5KS_.js +73 -0
  8. package/date-picker.element-Bg3rF95F.js +94 -0
  9. package/{date-time-calendar.element-DlbWZjoe.js → date-time-calendar.element-sywQCeQQ.js} +24 -24
  10. package/date-time-picker.element-HHpwjWTQ.js +107 -0
  11. package/{date-time.element-CLLxM2nV.js → date-time.element-ucETvSTC.js} +26 -26
  12. package/{date.element-B8ZHK9KJ.js → date.element-BEHGxRFF.js} +27 -27
  13. package/default-list-item-renderer-CuPJ9jUD.js +24 -0
  14. package/{dropdown.element-DMZ7oL5n.js → dropdown.element-DUqG_p1x.js} +85 -84
  15. package/{flex.element-DG4Uaj_X.js → flex.element-pwba7621.js} +27 -28
  16. package/{grid.element-DCZsh-3J.js → grid.element-C8K7_Qi3.js} +29 -30
  17. package/index.js +1316 -3883
  18. package/index.umd.cjs +117 -2132
  19. package/{list.element-ADtUK2na.js → list.element-ZtEMKE2x.js} +41 -40
  20. package/markdown-text.element-DDm36qD0.js +54 -0
  21. package/markdown.element-DWz3U9rG.js +84 -0
  22. package/number.element-VkG5wScD.js +71 -0
  23. package/package.json +6 -6
  24. package/password.element-C5vQHq5P.js +72 -0
  25. package/radiogroup.element-CKdO9HwO.js +69 -0
  26. package/{range-calendar.element-D5eb2f7p.js → range-calendar.element-BznGrej5.js} +23 -24
  27. package/{range-date-input.element-C35grlYo.js → range-date-input.element-BloTHRDl.js} +24 -24
  28. package/range-date-picker.element-DKhwFasW.js +98 -0
  29. package/{range-date-time-calendar.element-BV0J96Gu.js → range-date-time-calendar.element-CZCET-sb.js} +26 -26
  30. package/{range-date-time-input.element-CzgRbR9F.js → range-date-time-input.element-Dr2VrYhG.js} +24 -24
  31. package/range-date-time-picker.element-CYeIMWLp.js +109 -0
  32. package/{range-time-input.element-BOHLUO8z.js → range-time-input.element-7OZhPQqx.js} +23 -23
  33. package/range-time-picker.element-D0mRFZkK.js +96 -0
  34. package/renderer.element-DbsFoBba.js +48 -0
  35. package/{repeater.element-Da8YN1Vy.js → repeater.element-DGEbwvhY.js} +54 -65
  36. package/select.element-Bb_9jAVB.js +76 -0
  37. package/{tabs.element-CvcIA8P3.js → tabs.element-BYDNF_pm.js} +49 -50
  38. package/tags.element-BSN3i9Gx.js +73 -0
  39. package/textarea.element-Dl1ZEOqO.js +71 -0
  40. package/textinput.element-C5Vbbkxq.js +68 -0
  41. package/{time-picker.element-C3oR0EkQ.js → time-picker.element-Crmj9YDy.js} +26 -26
  42. package/{time.element-X286nthD.js → time.element-DfSeAZp4.js} +29 -29
  43. package/toggle.element-ORsprZ2M.js +66 -0
  44. package/alert.element-DPWq9-0F.js +0 -56
  45. package/button.element-CJay43iR.js +0 -132
  46. package/calendar-DleRbmvP.js +0 -267
  47. package/checkbox.element-CpmrzdH0.js +0 -200
  48. package/currency.element-Cezgzbbs.js +0 -276
  49. package/date-DBuYpvcO.js +0 -849
  50. package/date-input-B3yHsn-g.js +0 -204
  51. package/date-picker.element-ByZefznr.js +0 -357
  52. package/date-time-calendar-CB5cNoOX.js +0 -374
  53. package/date-time-input-DrY68YDX.js +0 -246
  54. package/date-time-picker.element-CYwmumfq.js +0 -440
  55. package/day-status-ljexnwEO.js +0 -554
  56. package/errors-Bs_vYN-_.js +0 -110
  57. package/focus-leave.controller-2gV0pQd5.js +0 -73
  58. package/list-D730tmGN.js +0 -297
  59. package/markdown-text-X-BRJT6K.js +0 -30
  60. package/markdown-text.element-B8TfVLIO.js +0 -55
  61. package/markdown.element-D5zcxAUS.js +0 -693
  62. package/number.element-DEY5tR_y.js +0 -291
  63. package/numeric-jmOOKz30.js +0 -12
  64. package/one-of-anKkm7mD.js +0 -50
  65. package/part-templates-VORbpgs2.js +0 -691
  66. package/password.element-C1aQh_iz.js +0 -240
  67. package/pill-ranges-DpvWwP-3.js +0 -48
  68. package/pills-BDMO2NiR.js +0 -348
  69. package/popup.controller-B33OvX_y.js +0 -86
  70. package/radiogroup.element-B2G-XyGx.js +0 -235
  71. package/range-calendar-D7sG24Kx.js +0 -466
  72. package/range-commit-8-MmYUyo.js +0 -14
  73. package/range-date-input-BChaoBC1.js +0 -311
  74. package/range-date-picker.element-Do5YsL5V.js +0 -434
  75. package/range-date-time-calendar-DulGK2EQ.js +0 -734
  76. package/range-date-time-input-8ggqckP7.js +0 -353
  77. package/range-date-time-picker.element-hi5KdopZ.js +0 -472
  78. package/range-selection-CU3hxLJE.js +0 -25
  79. package/range-time-input-D7GFdDeA.js +0 -348
  80. package/range-time-picker.element-DDNQMA_u.js +0 -470
  81. package/renderer.element-CNyMn2Lu.js +0 -49
  82. package/select.element-SDxBhGjz.js +0 -266
  83. package/tabs-DzSCq_98.js +0 -13
  84. package/tags.element-Bnhfevp3.js +0 -369
  85. package/templates-Df7abEkB.js +0 -92
  86. package/textarea.element-Dx7eYEnl.js +0 -239
  87. package/textinput.element-BnIoDRmY.js +0 -205
  88. package/time-input-Kk4EX6at.js +0 -201
  89. package/time-list-DLcq8BAp.js +0 -217
  90. package/time-picker-DLj1rhOf.js +0 -299
  91. package/toggle.element-Dokdat_o.js +0 -203
@@ -1,353 +0,0 @@
1
- import { LitElement as g, nothing as p, html as u } from "lit";
2
- import { property as a, customElement as c } from "lit/decorators.js";
3
- import { classMap as y } from "lit/directives/class-map.js";
4
- import { styleMap as v } from "lit-html/directives/style-map.js";
5
- import { G as b, b as f, c as D } from "./templates-Df7abEkB.js";
6
- import { G as A, g as S, a as P, r as h, f as T, p as m, b as L, d as _, m as E, c as R, o as C, P as $ } from "./part-templates-VORbpgs2.js";
7
- import { c as k } from "./range-commit-8-MmYUyo.js";
8
- import { r as I, f as M, b as w, a as B, s as F } from "./pill-ranges-DpvWwP-3.js";
9
- import "./pills-BDMO2NiR.js";
10
- import { D as O } from "./date-DBuYpvcO.js";
11
- var x = Object.defineProperty, G = Object.getOwnPropertyDescriptor, i = (e, r, l, s) => {
12
- for (var o = s > 1 ? void 0 : s ? G(r, l) : r, n = e.length - 1, d; n >= 0; n--)
13
- (d = e[n]) && (o = (s ? d(r, l, o) : d(o)) || o);
14
- return s && o && x(r, l, o), o;
15
- };
16
- let t = class extends g {
17
- constructor() {
18
- super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.invalidDateMessage = void 0, this.value = [], this.removePillAriaLabel = void 0, this.startDateTimeAriaLabel = void 0, this.endDateTimeAriaLabel = void 0, this.separator = 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.inputBlockClass = "gui-range-date-time-input", this.groups = ["start", "end"], this._validationTriggered = !1, this._parts = new A(this, {
19
- blockClass: this.inputBlockClass,
20
- groups: this.groups,
21
- getDescriptor: (e) => this.getPartDescriptor(e),
22
- commitGroup: () => {
23
- this._validationTriggered ? this.revalidate() : this.syncParts();
24
- },
25
- isReadonly: () => !!this.readOnly,
26
- isDisabled: () => !!this.disabled,
27
- onEmptyPartBlur: () => {
28
- },
29
- onEnter: () => {
30
- this.tryCreatePill(), this.value && this.value.length > 0 && this.onPillClick(this.value[this.value.length - 1]);
31
- },
32
- getHourFormat: () => this.localeData.effectiveHourFormat,
33
- getDayPeriodLabels: () => this.localeData.dayPeriodLabels,
34
- onInputErrorSurfaced: (e) => this.dispatchEvent(new CustomEvent("inputError", { detail: { message: e }, bubbles: !0 })),
35
- onSurfacedErrorCleared: (e) => this.dispatchEvent(
36
- new CustomEvent("change", { detail: { value: e }, bubbles: !0, composed: !0 })
37
- )
38
- }), this.ariaController = new b(this, {
39
- getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
40
- getState: () => ({
41
- uid: this.uid,
42
- templateData: {
43
- hint: this.hint,
44
- errors: this.errors,
45
- readonly: this.readOnly,
46
- disabled: this.disabled,
47
- touched: this.touched,
48
- required: this.required
49
- }
50
- })
51
- }), this.onPillRemoveEvent = (e) => {
52
- if (this.disabled || this.readOnly) return;
53
- const r = I(this.value, e.detail.key);
54
- r && (this.value = r.next, this.dispatchEvent(
55
- new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
56
- ), r.next.length === 0 && requestAnimationFrame(() => {
57
- this.querySelector(".gui-range-date-time-input__field input")?.focus();
58
- }));
59
- }, this.onPillClickEvent = (e) => {
60
- const r = M(this.getSortedPills(), e.detail.key);
61
- r && this.onPillClick(r);
62
- };
63
- }
64
- createRenderRoot() {
65
- return this;
66
- }
67
- connectedCallback() {
68
- super.connectedCallback(), this.classList.add("gui-field");
69
- }
70
- get localeData() {
71
- return S(this.localeId, this.hourFormat, this.minuteStep, !0);
72
- }
73
- getPartDescriptor(e) {
74
- return this.localeData.descriptors[e];
75
- }
76
- willUpdate(e) {
77
- (!this.hasUpdated || e.has("hourFormat") || e.has("localeId")) && this._parts.seedDayPeriods();
78
- }
79
- render() {
80
- const e = {
81
- uid: this.uid,
82
- label: this.label,
83
- errors: this.errors,
84
- touched: this.touched,
85
- required: this.required,
86
- disabled: this.disabled,
87
- readonly: this.readOnly,
88
- value: this.value,
89
- hint: this.hint
90
- }, r = {
91
- blockClass: this.inputBlockClass,
92
- groups: this.groups,
93
- formatParts: P(this.localeId, this.localeData.effectiveHourFormat),
94
- getDescriptor: (o) => this.getPartDescriptor(o),
95
- getDisplayValue: this._parts.getPartDisplay,
96
- getPartAriaLabel: (o, n) => ({
97
- day: this.dayAriaLabel,
98
- month: this.monthAriaLabel,
99
- year: this.yearAriaLabel,
100
- hour: this.hourAriaLabel,
101
- minute: this.minuteAriaLabel
102
- })[n] ?? $[n],
103
- dayPeriodAriaLabel: this.dayPeriodAriaLabel,
104
- disabled: this.disabled,
105
- partsReadonly: !!this.readOnly
106
- }, l = w(
107
- this.getSortedPills(),
108
- (o) => B(o, (n) => this.formatDateTimeForDisplay(n))
109
- ), s = {
110
- "gui-widget-icon": !0,
111
- [this.icon]: !!this.icon
112
- };
113
- return u`
114
- ${this.label ? f(this.uid, e, !1, void 0, !1) : p}
115
-
116
- <div class="gui-widget">
117
- <div
118
- class="gui-widget-input gui-parts-ring gui-range-date-time-input ${this.icon ? "gui-range-date-time-input--icon" : ""}"
119
- role="group"
120
- aria-label=${this.label ?? "Date-time range input"}
121
- >
122
- ${this.icon ? u`<span
123
- class=${y(s)}
124
- data-icon=${this.icon}
125
- aria-hidden="true"
126
- ></span>` : p}
127
-
128
- <gui-pills
129
- class="gui-range-date-time-input__pills"
130
- style=${v(l.length ? {} : { "min-width": 0 })}
131
- .uid=${this.uid}
132
- .toolbarAriaLabel=${"Selected date-time ranges"}
133
- .items=${l}
134
- .removable=${!0}
135
- .clickable=${!0}
136
- .bubble=${!0}
137
- ?disabled=${this.disabled}
138
- ?readonly=${this.readOnly}
139
- .removeAriaLabel=${this.removePillAriaLabel ?? "Remove date-time"}
140
- .compactAriaLabel=${`${l.length} date-time ranges`}
141
- @pillremove=${this.onPillRemoveEvent}
142
- @pillclick=${this.onPillClickEvent}
143
- ></gui-pills>
144
-
145
- <div class="gui-range-date-time-input__inputs">
146
- <div
147
- class="gui-parts gui-range-date-time-input__field"
148
- role="group"
149
- aria-label=${this.startDateTimeAriaLabel ?? "Start date-time"}
150
- >
151
- ${h("start", r, this._parts)}
152
- </div>
153
-
154
- <span class="gui-range-date-time-input__separator">${this.separator ?? "-"}</span>
155
-
156
- <div
157
- class="gui-parts gui-range-date-time-input__field"
158
- role="group"
159
- aria-label=${this.endDateTimeAriaLabel ?? "End date-time"}
160
- >
161
- ${h("end", r, this._parts)}
162
- </div>
163
- </div>
164
- </div>
165
-
166
- ${this.showErrors && this.errors?.length ? D(this.uid, e) : p}
167
- </div>
168
- `;
169
- }
170
- onPillClick(e) {
171
- this.dispatchEvent(
172
- new CustomEvent("pillClick", { detail: { range: e }, bubbles: !0, composed: !0 })
173
- );
174
- }
175
- formatDateTimeForDisplay(e) {
176
- return T(e, this.localeId, this.localeData.effectiveHourFormat);
177
- }
178
- getSortedPills() {
179
- return F(
180
- this.value,
181
- (e, r) => m(e).getTime() - m(r).getTime()
182
- );
183
- }
184
- /**
185
- * Parses a group into an ISO date-time via the shared clamp/bounds pipeline,
186
- * distinguishing an incomplete group (nothing to report) from a
187
- * complete-but-rejected one (an impossible date or an out-of-bounds
188
- * date-time). It does not emit: the caller decides whether to surface or
189
- * clear an error, so fixing one group clears its error even while the other
190
- * is still empty.
191
- *
192
- * Each endpoint is an instant, so it is bounded by instants. A date-only
193
- * bound could not express this: `maxDate: 2026-02-10` is ambiguous about
194
- * whether the 10th is allowed until 00:00 or 23:59, and independent date/time
195
- * axes would wrongly reject Feb 11 08:00 for a `minTime` of 09:00.
196
- */
197
- validateDateTimeParts(e) {
198
- const { effectiveHourFormat: r, descriptors: l } = this.localeData, { result: s, writeBacks: o } = L(this._parts.values[e] ?? {}, {
199
- hourFormat: r,
200
- descriptors: l,
201
- invalidDateMessage: this.invalidDateMessage
202
- });
203
- if (this._parts.applyWriteBacks(e, o), s.kind === "incomplete") return { kind: "incomplete" };
204
- if (s.kind === "invalid") return { kind: "invalid", message: s.message };
205
- const n = _(s.iso, this.minDateTime, this.maxDateTime, {
206
- minDateTimeMessage: this.minDateTimeMessage,
207
- maxDateTimeMessage: this.maxDateTimeMessage
208
- });
209
- return n ? { kind: "invalid", message: n } : { kind: "valid", value: s.iso };
210
- }
211
- /**
212
- * Re-parses both endpoints so per-endpoint problems (impossible date-time,
213
- * out of instant bounds) surface while the user types. Runs on every part
214
- * change.
215
- */
216
- syncParts() {
217
- return {
218
- start: this.validateDateTimeParts("start"),
219
- end: this.validateDateTimeParts("end")
220
- };
221
- }
222
- /**
223
- * Parses the range and updates the error state, without ever committing.
224
- * Shared by the Enter commit and by {@link revalidate}.
225
- */
226
- evaluateRange() {
227
- const { start: e, end: r } = this.syncParts(), l = k(e, r, this.value, {
228
- // Date-time ranges are two instants: a backward selection reorders (swap)
229
- // rather than erroring — mirroring the range calendar's date swap.
230
- order: (s, o) => {
231
- const n = C(s, o);
232
- return { start: n.start, end: n.end };
233
- },
234
- validate: (s) => R({ start: s.start, end: s.end }, this.disabledRanges) ? this.disabledRangeMessage ?? O : null,
235
- toRange: (s) => ({ start: s.start, end: s.end }),
236
- merge: E
237
- });
238
- return l.kind === "invalid" && this._parts.surfaceInputError(l.message), l.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), l;
239
- }
240
- /**
241
- * Once the user has attempted a commit, every later edit re-runs validation
242
- * so a corrected range clears its error immediately, otherwise the message
243
- * would linger until the next Enter and the user could not tell the problem
244
- * was solved.
245
- */
246
- revalidate() {
247
- this.evaluateRange().kind === "commit" && this._parts.clearSurfacedInputError(this.value ?? []);
248
- }
249
- tryCreatePill() {
250
- this._validationTriggered = !0;
251
- const e = this.evaluateRange();
252
- e.kind === "commit" && (this.value = e.value, this._validationTriggered = !1, this._parts.clearGroup("start"), this._parts.clearGroup("end"), this._parts.seedDayPeriods(), this._parts.resetSurfacedInputError(), this.dispatchEvent(
253
- new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
254
- ), this._parts.focusFirst("start"), this.requestUpdate());
255
- }
256
- };
257
- i([
258
- a({ type: String })
259
- ], t.prototype, "uid", 2);
260
- i([
261
- a({ type: String })
262
- ], t.prototype, "label", 2);
263
- i([
264
- a({ type: String, attribute: "locale-id" })
265
- ], t.prototype, "localeId", 2);
266
- i([
267
- a({ type: Array })
268
- ], t.prototype, "errors", 2);
269
- i([
270
- a({ type: Boolean })
271
- ], t.prototype, "showErrors", 2);
272
- i([
273
- a({ type: Boolean })
274
- ], t.prototype, "touched", 2);
275
- i([
276
- a({ type: Boolean })
277
- ], t.prototype, "required", 2);
278
- i([
279
- a({ type: Boolean })
280
- ], t.prototype, "disabled", 2);
281
- i([
282
- a({ type: Boolean, attribute: "readonly" })
283
- ], t.prototype, "readOnly", 2);
284
- i([
285
- a({ type: String })
286
- ], t.prototype, "icon", 2);
287
- i([
288
- a({ type: String })
289
- ], t.prototype, "hint", 2);
290
- i([
291
- a({ type: String })
292
- ], t.prototype, "dayAriaLabel", 2);
293
- i([
294
- a({ type: String })
295
- ], t.prototype, "monthAriaLabel", 2);
296
- i([
297
- a({ type: String })
298
- ], t.prototype, "yearAriaLabel", 2);
299
- i([
300
- a({ type: String })
301
- ], t.prototype, "hourAriaLabel", 2);
302
- i([
303
- a({ type: String })
304
- ], t.prototype, "minuteAriaLabel", 2);
305
- i([
306
- a({ type: String })
307
- ], t.prototype, "dayPeriodAriaLabel", 2);
308
- i([
309
- a({ type: String, attribute: "hour-format" })
310
- ], t.prototype, "hourFormat", 2);
311
- i([
312
- a({ type: Number, attribute: "minute-step" })
313
- ], t.prototype, "minuteStep", 2);
314
- i([
315
- a({ type: String, attribute: "invalid-date-message" })
316
- ], t.prototype, "invalidDateMessage", 2);
317
- i([
318
- a({ type: Array })
319
- ], t.prototype, "value", 2);
320
- i([
321
- a({ type: String })
322
- ], t.prototype, "removePillAriaLabel", 2);
323
- i([
324
- a({ type: String })
325
- ], t.prototype, "startDateTimeAriaLabel", 2);
326
- i([
327
- a({ type: String })
328
- ], t.prototype, "endDateTimeAriaLabel", 2);
329
- i([
330
- a({ type: String })
331
- ], t.prototype, "separator", 2);
332
- i([
333
- a({ type: String, attribute: "min-date-time" })
334
- ], t.prototype, "minDateTime", 2);
335
- i([
336
- a({ type: String, attribute: "max-date-time" })
337
- ], t.prototype, "maxDateTime", 2);
338
- i([
339
- a({ type: String, attribute: "min-date-time-message" })
340
- ], t.prototype, "minDateTimeMessage", 2);
341
- i([
342
- a({ type: String, attribute: "max-date-time-message" })
343
- ], t.prototype, "maxDateTimeMessage", 2);
344
- i([
345
- a({ type: Array, attribute: "disabled-ranges" })
346
- ], t.prototype, "disabledRanges", 2);
347
- i([
348
- a({ type: String, attribute: "disabled-range-message" })
349
- ], t.prototype, "disabledRangeMessage", 2);
350
- t = i([
351
- c("gui-range-date-time")
352
- ], t);
353
- typeof customElements < "u" && !customElements.get("gui-range-date-time") && customElements.define("gui-range-date-time", t);