@golemui/gui-lit 1.2.0 → 1.2.1

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 +31 -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,348 +0,0 @@
1
- import { LitElement as c, nothing as d, html as p } from "lit";
2
- import { property as a, customElement as g } from "lit/decorators.js";
3
- import { classMap as v } from "lit/directives/class-map.js";
4
- import { styleMap as y } from "lit-html/directives/style-map.js";
5
- import { G as b, b as f, c as T } from "./templates-Df7abEkB.js";
6
- import { G as _, g as E, u as P, r as h, l as L, s as m, v as S, w as A, x as C, t as D, P as R } from "./part-templates-VORbpgs2.js";
7
- import { c as $ } from "./range-commit-8-MmYUyo.js";
8
- import { r as I, f as w, b as k, a as M, s as F } from "./pill-ranges-DpvWwP-3.js";
9
- import "./pills-BDMO2NiR.js";
10
- import { f as B, e as O } from "./date-DBuYpvcO.js";
11
- var G = Object.defineProperty, x = Object.getOwnPropertyDescriptor, i = (t, s, o, r) => {
12
- for (var l = r > 1 ? void 0 : r ? x(s, o) : s, n = t.length - 1, u; n >= 0; n--)
13
- (u = t[n]) && (l = (r ? u(s, o, l) : u(l)) || l);
14
- return r && l && G(s, o, l), l;
15
- };
16
- let e = class extends c {
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.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.hourFormat = void 0, this.minuteStep = 1, this.minTime = void 0, this.maxTime = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.value = [], this.rangeOrderMessage = void 0, this.removePillAriaLabel = void 0, this.startTimeAriaLabel = void 0, this.endTimeAriaLabel = void 0, this.separator = void 0, this.allowCustomTime = void 0, this.disabledRanges = void 0, this.disabledRangeMessage = void 0, this.inputBlockClass = "gui-range-time-input", this.groups = ["start", "end"], this._validationTriggered = !1, this._parts = new _(this, {
19
- blockClass: this.inputBlockClass,
20
- groups: this.groups,
21
- getDescriptor: (t) => this.getPartDescriptor(t),
22
- commitGroup: () => {
23
- this._validationTriggered ? this.revalidate() : this.syncParts();
24
- },
25
- onInputErrorSurfaced: (t) => this.dispatchEvent(new CustomEvent("inputError", { detail: { message: t }, bubbles: !0 })),
26
- onSurfacedErrorCleared: (t) => this.dispatchEvent(
27
- new CustomEvent("change", { detail: { value: t }, bubbles: !0, composed: !0 })
28
- ),
29
- isReadonly: () => !!this.readOnly || this.allowCustomTime === !1,
30
- isDisabled: () => !!this.disabled,
31
- onEmptyPartBlur: () => {
32
- },
33
- onEnter: () => {
34
- this.tryCreatePill(), this.value && this.value.length > 0 && this.onPillClick(this.value[this.value.length - 1]);
35
- },
36
- getHourFormat: () => this.timeLocaleData.effectiveHourFormat,
37
- getDayPeriodLabels: () => this.timeLocaleData.dayPeriodLabels
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 = (t) => {
52
- if (this.disabled || this.readOnly) return;
53
- const s = I(this.value, t.detail.key);
54
- s && (this.value = s.next, this.dispatchEvent(
55
- new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
56
- ), s.next.length === 0 && requestAnimationFrame(() => {
57
- this.querySelector(".gui-range-time-input__field input")?.focus();
58
- }));
59
- }, this.onPillClickEvent = (t) => {
60
- const s = w(this.getSortedPills(), t.detail.key);
61
- s && this.onPillClick(s);
62
- };
63
- }
64
- createRenderRoot() {
65
- return this;
66
- }
67
- connectedCallback() {
68
- super.connectedCallback(), this.classList.add("gui-field");
69
- }
70
- get timeLocaleData() {
71
- return E(this.localeId, this.hourFormat, this.minuteStep);
72
- }
73
- getPartDescriptor(t) {
74
- return this.timeLocaleData.descriptors[t];
75
- }
76
- willUpdate(t) {
77
- (!this.hasUpdated || t.has("hourFormat") || t.has("localeId")) && this._parts.seedDayPeriods();
78
- }
79
- render() {
80
- const t = {
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
- }, s = {
91
- blockClass: this.inputBlockClass,
92
- groups: this.groups,
93
- formatParts: P(this.localeId, this.timeLocaleData.effectiveHourFormat),
94
- getDescriptor: (l) => this.getPartDescriptor(l),
95
- getDisplayValue: this._parts.getPartDisplay,
96
- getPartAriaLabel: (l, n) => ({
97
- hour: this.hourAriaLabel,
98
- minute: this.minuteAriaLabel
99
- })[n] ?? R[n],
100
- dayPeriodAriaLabel: this.dayPeriodAriaLabel,
101
- disabled: this.disabled,
102
- partsReadonly: !!this.readOnly || this.allowCustomTime === !1
103
- }, o = k(
104
- this.getSortedPills(),
105
- (l) => M(l, (n) => this.formatTimeForDisplay(n))
106
- ), r = {
107
- "gui-widget-icon": !0,
108
- [this.icon]: !!this.icon
109
- };
110
- return p`
111
- ${this.label ? f(this.uid, t, !1, void 0, !1) : d}
112
-
113
- <div class="gui-widget">
114
- <div
115
- class="gui-widget-input gui-parts-ring gui-range-time-input ${this.icon ? "gui-range-time-input--icon" : ""}"
116
- role="group"
117
- aria-label=${this.label ?? "Time range input"}
118
- >
119
- ${this.icon ? p`<span
120
- class=${v(r)}
121
- data-icon=${this.icon}
122
- aria-hidden="true"
123
- ></span>` : d}
124
-
125
- <gui-pills
126
- class="gui-range-time-input__pills"
127
- style=${y(o.length ? {} : { "min-width": 0 })}
128
- .uid=${this.uid}
129
- .toolbarAriaLabel=${"Selected time ranges"}
130
- .items=${o}
131
- .removable=${!0}
132
- .clickable=${!0}
133
- .bubble=${!0}
134
- ?disabled=${this.disabled}
135
- ?readonly=${this.readOnly}
136
- .removeAriaLabel=${this.removePillAriaLabel ?? "Remove time"}
137
- .compactAriaLabel=${`${o.length} time ranges`}
138
- @pillremove=${this.onPillRemoveEvent}
139
- @pillclick=${this.onPillClickEvent}
140
- ></gui-pills>
141
-
142
- <div class="gui-range-time-input__inputs">
143
- <div
144
- class="gui-parts gui-range-time-input__field"
145
- role="group"
146
- aria-label=${this.startTimeAriaLabel ?? "Start time"}
147
- >
148
- ${h("start", s, this._parts)}
149
- </div>
150
-
151
- <span class="gui-range-time-input__separator">${this.separator ?? "-"}</span>
152
-
153
- <div
154
- class="gui-parts gui-range-time-input__field"
155
- role="group"
156
- aria-label=${this.endTimeAriaLabel ?? "End time"}
157
- >
158
- ${h("end", s, this._parts)}
159
- </div>
160
- </div>
161
- </div>
162
-
163
- ${this.showErrors && this.errors?.length ? T(this.uid, t) : d}
164
- </div>
165
- `;
166
- }
167
- onPillClick(t) {
168
- this.dispatchEvent(
169
- new CustomEvent("pillClick", { detail: { range: t }, bubbles: !0, composed: !0 })
170
- );
171
- }
172
- formatTimeForDisplay(t) {
173
- return L(t, this.localeId, this.timeLocaleData.effectiveHourFormat);
174
- }
175
- getSortedPills() {
176
- return F(this.value, m);
177
- }
178
- /**
179
- * Parses a group's parts into an ISO time via the shared clamp/bounds
180
- * pipeline, surfacing a bounds violation as an inputError. Returns null while
181
- * the group is incomplete or out of bounds.
182
- */
183
- validateTimeParts(t) {
184
- const { effectiveHourFormat: s, descriptors: o } = this.timeLocaleData, { result: r, writeBacks: l } = S(this._parts.values[t] ?? {}, {
185
- hourFormat: s,
186
- descriptors: o
187
- });
188
- if (this._parts.applyWriteBacks(t, l), r.kind !== "valid") return { kind: "incomplete" };
189
- const n = A(r.iso, {
190
- minTime: this.minTime,
191
- maxTime: this.maxTime,
192
- minTimeMessage: this.minTimeMessage,
193
- maxTimeMessage: this.maxTimeMessage
194
- });
195
- return n ? { kind: "invalid", message: n } : { kind: "valid", value: r.iso };
196
- }
197
- /**
198
- * Fills a group's segmented parts from an ISO time. The range time picker
199
- * calls this so a list pick lands in the visible input (start/end field)
200
- * before it attempts to commit — see {@link commitFromParts}.
201
- */
202
- fillGroup(t, s) {
203
- this._parts.setGroupFromISO(t, s, "time", this.timeLocaleData.effectiveHourFormat), this.requestUpdate();
204
- }
205
- /**
206
- * Attempts to commit the currently-entered parts as a pill, returning whether
207
- * one was created. A public entry point onto the same {@link tryCreatePill}
208
- * pipeline typed entry uses, so the picker's list-driven commits validate
209
- * (order + bounds + disabled ranges) through one path.
210
- */
211
- commitFromParts() {
212
- return this.tryCreatePill();
213
- }
214
- /**
215
- * Re-parses both endpoints (surfacing per-endpoint bounds errors as the user
216
- * types) and notifies the host picker via `partsChange` so its time lists
217
- * follow the typed values. Runs on every part change.
218
- */
219
- syncParts() {
220
- const t = this.validateTimeParts("start"), s = this.validateTimeParts("end"), o = (r) => r.kind === "valid" ? r.value : null;
221
- return this.dispatchEvent(
222
- new CustomEvent("partsChange", {
223
- detail: { start: o(t), end: o(s) },
224
- bubbles: !0,
225
- composed: !0
226
- })
227
- ), { start: t, end: s };
228
- }
229
- /**
230
- * Parses the range and updates the error state, without ever committing.
231
- * Shared by the Enter commit and by {@link revalidate}.
232
- */
233
- evaluateRange() {
234
- const { start: t, end: s } = this.syncParts(), o = $(t, s, this.value, {
235
- validate: (r) => m(r.end, r.start) <= 0 ? this.rangeOrderMessage ?? B : D(r.start, r.end, this.disabledRanges) ? this.disabledRangeMessage ?? O : null,
236
- toRange: (r) => ({ start: r.start, end: r.end }),
237
- merge: C
238
- });
239
- return o.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), o.kind === "invalid" && this._parts.surfaceInputError(o.message), o;
240
- }
241
- /**
242
- * Once the user has attempted a commit, every later edit re-runs validation
243
- * so a corrected range clears its error immediately, otherwise the message
244
- * would linger until the next Enter and the user could not tell the problem
245
- * was solved.
246
- */
247
- revalidate() {
248
- this.evaluateRange().kind === "commit" && this._parts.clearSurfacedInputError(this.value ?? []);
249
- }
250
- tryCreatePill() {
251
- this._validationTriggered = !0;
252
- const t = this.evaluateRange();
253
- return t.kind !== "commit" ? !1 : (this.value = t.value, this._validationTriggered = !1, this._parts.clearGroup("start"), this._parts.clearGroup("end"), this._parts.seedDayPeriods(), this.dispatchEvent(
254
- new CustomEvent("change", { detail: { value: this.value }, bubbles: !0, composed: !0 })
255
- ), this._parts.focusFirst("start"), this.requestUpdate(), !0);
256
- }
257
- };
258
- i([
259
- a({ type: String })
260
- ], e.prototype, "uid", 2);
261
- i([
262
- a({ type: String })
263
- ], e.prototype, "label", 2);
264
- i([
265
- a({ type: String, attribute: "locale-id" })
266
- ], e.prototype, "localeId", 2);
267
- i([
268
- a({ type: Array })
269
- ], e.prototype, "errors", 2);
270
- i([
271
- a({ type: Boolean })
272
- ], e.prototype, "showErrors", 2);
273
- i([
274
- a({ type: Boolean })
275
- ], e.prototype, "touched", 2);
276
- i([
277
- a({ type: Boolean })
278
- ], e.prototype, "required", 2);
279
- i([
280
- a({ type: Boolean })
281
- ], e.prototype, "disabled", 2);
282
- i([
283
- a({ type: Boolean, attribute: "readonly" })
284
- ], e.prototype, "readOnly", 2);
285
- i([
286
- a({ type: String })
287
- ], e.prototype, "icon", 2);
288
- i([
289
- a({ type: String })
290
- ], e.prototype, "hint", 2);
291
- i([
292
- a({ type: String })
293
- ], e.prototype, "hourAriaLabel", 2);
294
- i([
295
- a({ type: String })
296
- ], e.prototype, "minuteAriaLabel", 2);
297
- i([
298
- a({ type: String })
299
- ], e.prototype, "dayPeriodAriaLabel", 2);
300
- i([
301
- a({ type: String, attribute: "hour-format" })
302
- ], e.prototype, "hourFormat", 2);
303
- i([
304
- a({ type: Number, attribute: "minute-step" })
305
- ], e.prototype, "minuteStep", 2);
306
- i([
307
- a({ type: String, attribute: "min-time" })
308
- ], e.prototype, "minTime", 2);
309
- i([
310
- a({ type: String, attribute: "max-time" })
311
- ], e.prototype, "maxTime", 2);
312
- i([
313
- a({ type: String, attribute: "min-time-message" })
314
- ], e.prototype, "minTimeMessage", 2);
315
- i([
316
- a({ type: String, attribute: "max-time-message" })
317
- ], e.prototype, "maxTimeMessage", 2);
318
- i([
319
- a({ type: Array })
320
- ], e.prototype, "value", 2);
321
- i([
322
- a({ type: String, attribute: "range-order-message" })
323
- ], e.prototype, "rangeOrderMessage", 2);
324
- i([
325
- a({ type: String })
326
- ], e.prototype, "removePillAriaLabel", 2);
327
- i([
328
- a({ type: String })
329
- ], e.prototype, "startTimeAriaLabel", 2);
330
- i([
331
- a({ type: String })
332
- ], e.prototype, "endTimeAriaLabel", 2);
333
- i([
334
- a({ type: String })
335
- ], e.prototype, "separator", 2);
336
- i([
337
- a({ type: Boolean, attribute: "allow-custom-time" })
338
- ], e.prototype, "allowCustomTime", 2);
339
- i([
340
- a({ type: Array, attribute: "disabled-ranges" })
341
- ], e.prototype, "disabledRanges", 2);
342
- i([
343
- a({ type: String, attribute: "disabled-range-message" })
344
- ], e.prototype, "disabledRangeMessage", 2);
345
- e = i([
346
- g("gui-range-time")
347
- ], e);
348
- typeof customElements < "u" && !customElements.get("gui-range-time") && customElements.define("gui-range-time", e);