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