@golemui/gui-lit 1.1.0 → 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.
- package/CHANGELOG.md +15 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/{calendar-BuJgwvZx.js → calendar-D31xNsxx.js} +72 -59
- package/{calendar.element-M5MPJmap.js → calendar.element-BhFrCsns.js} +22 -20
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-CfFrAtrr.js → currency.element-D8A2ObpM.js} +11 -10
- package/{date-Bj9mI3GU.js → date-DBuYpvcO.js} +35 -27
- package/{date-input-cJDkNnVw.js → date-input-DLiMreSS.js} +64 -44
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/{date-time-calendar-BzRfkLKU.js → date-time-calendar-DzU-FtVl.js} +89 -76
- package/{date-time-calendar.element-DC4NK0y1.js → date-time-calendar.element-BLBcVsFu.js} +13 -11
- package/{date-time-input-BXxsfuyZ.js → date-time-input-DZaz2heD.js} +75 -43
- package/{date-time-picker.element-Dy-8cb-_.js → date-time-picker.element-BUbLdV6i.js} +125 -65
- package/{date-time.element-Bv4XdzMi.js → date-time.element-B5onfSBG.js} +31 -25
- package/{date.element-Consgsbb.js → date.element-BsKhLrEc.js} +22 -19
- package/{day-status-0-hJHrI7.js → day-status-CsWStVQV.js} +153 -129
- package/{dropdown.element-WsD61Qel.js → dropdown.element-CXpMwJsU.js} +19 -13
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/index.js +1643 -1184
- package/index.umd.cjs +792 -399
- package/{list-CrLIL4by.js → list-D730tmGN.js} +115 -116
- package/{list.element-DV82YxnJ.js → list.element-eo3DIOrp.js} +2 -2
- package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
- package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
- package/package.json +6 -6
- package/{part-templates-Db871PS3.js → part-templates-VORbpgs2.js} +132 -118
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/{pill-ranges-DCqDmpkk.js → pill-ranges-DpvWwP-3.js} +12 -12
- package/{pills-Be1UrLgq.js → pills-BDMO2NiR.js} +80 -58
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/{range-calendar-CKPYeSGt.js → range-calendar-DO_woqcF.js} +101 -87
- package/{range-calendar.element-D6KYq18B.js → range-calendar.element-DHLZhpnj.js} +15 -13
- package/{range-date-input-D--AqBMv.js → range-date-input-Br7XqQPK.js} +90 -71
- package/{range-date-input.element-D4nIXJbw.js → range-date-input.element-BdD4SlB4.js} +15 -12
- package/{range-date-picker.element-dhxPAAE6.js → range-date-picker.element-DWRHiAoC.js} +97 -49
- package/{range-date-time-calendar-yksWrR7b.js → range-date-time-calendar-B3EMgN1E.js} +150 -136
- package/{range-date-time-calendar.element-C00aDefZ.js → range-date-time-calendar.element-Coea6RF4.js} +9 -7
- package/{range-date-time-input-B37TUoM3.js → range-date-time-input-Cu-T_nuC.js} +125 -94
- package/{range-date-time-input.element-DUnbv4ed.js → range-date-time-input.element-Cti44iuW.js} +31 -25
- package/{range-date-time-picker.element-Cbps6s_G.js → range-date-time-picker.element-CDN2RL1y.js} +107 -47
- package/{range-time-input-3lhqR1Ku.js → range-time-input-BP9ZL9O8.js} +85 -66
- package/{range-time-input.element-dU2iBdmJ.js → range-time-input.element-B7wtHJoQ.js} +14 -11
- package/{range-time-picker.element-v6nQsIPw.js → range-time-picker.element-CPIAiQPC.js} +92 -51
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-C0V-Bv3L.js → select.element-eepcXTpL.js} +84 -78
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-DvwEpxpK.js → tags.element-CPHgotb0.js} +21 -14
- package/templates-Dmr34nwp.js +88 -0
- package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
- package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
- package/{time-input-BOhlBGJZ.js → time-input-5dkSm8UW.js} +67 -47
- package/{time-list-Czo48bZm.js → time-list-DLcq8BAp.js} +1 -1
- package/{time-picker-bFJ63ky8.js → time-picker-g337F8d0.js} +89 -51
- package/{time-picker.element-CYZVXgRS.js → time-picker.element-DLihegjg.js} +23 -19
- package/{time.element-fK3oLi49.js → time.element-BneqgMlQ.js} +22 -19
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- package/date-picker.element-va_-LGZD.js +0 -312
- package/popup.controller-eUDxE6jD.js +0 -71
- package/templates-Dk1jxLwS.js +0 -75
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { LitElement as v, nothing as p, html as u } from "lit";
|
|
2
|
-
import { property as
|
|
2
|
+
import { property as r, customElement as m } from "lit/decorators.js";
|
|
3
3
|
import { classMap as y } from "lit/directives/class-map.js";
|
|
4
|
-
import { G as b, b as f, c as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
8
|
-
import { c as O, o as
|
|
9
|
-
import "./pills-
|
|
10
|
-
import { styleMap as
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(d = t[o]) && (
|
|
14
|
-
return n &&
|
|
4
|
+
import { G as b, b as f, c as _ } from "./templates-Dmr34nwp.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
15
|
};
|
|
16
16
|
let i = class extends v {
|
|
17
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.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 =
|
|
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
19
|
blockClass: this.inputBlockClass,
|
|
20
20
|
groups: this.groups,
|
|
21
21
|
getDescriptor: (t) => this.getPartDescriptor(t),
|
|
@@ -45,12 +45,13 @@ let i = class extends v {
|
|
|
45
45
|
errors: this.errors,
|
|
46
46
|
readonly: this.readOnly,
|
|
47
47
|
disabled: this.disabled,
|
|
48
|
-
touched: this.touched
|
|
48
|
+
touched: this.touched,
|
|
49
|
+
required: this.required
|
|
49
50
|
}
|
|
50
51
|
})
|
|
51
52
|
}), this.onPillRemoveEvent = (t) => {
|
|
52
53
|
if (this.disabled || this.readOnly) return;
|
|
53
|
-
const e =
|
|
54
|
+
const e = C(this.value, t.detail.key);
|
|
54
55
|
e && (this.value = e.next, this.dispatchEvent(
|
|
55
56
|
new CustomEvent("change", {
|
|
56
57
|
detail: { value: this.value },
|
|
@@ -63,7 +64,7 @@ let i = class extends v {
|
|
|
63
64
|
)?.focus();
|
|
64
65
|
}));
|
|
65
66
|
}, this.onPillClickEvent = (t) => {
|
|
66
|
-
const e =
|
|
67
|
+
const e = $(this.getSortedPills(), t.detail.key);
|
|
67
68
|
e && this.onPillClick(e);
|
|
68
69
|
};
|
|
69
70
|
}
|
|
@@ -90,16 +91,19 @@ let i = class extends v {
|
|
|
90
91
|
}, e = {
|
|
91
92
|
blockClass: this.inputBlockClass,
|
|
92
93
|
groups: this.groups,
|
|
93
|
-
formatParts:
|
|
94
|
-
getDescriptor: (
|
|
94
|
+
formatParts: A(this.localeId),
|
|
95
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
95
96
|
getDisplayValue: this._parts.getPartDisplay,
|
|
96
|
-
|
|
97
|
+
getPartAriaLabel: (s, o) => ({
|
|
98
|
+
day: this.dayAriaLabel,
|
|
99
|
+
month: this.monthAriaLabel,
|
|
100
|
+
year: this.yearAriaLabel
|
|
101
|
+
})[o] ?? E[o],
|
|
97
102
|
disabled: this.disabled,
|
|
98
103
|
partsReadonly: !!this.readOnly
|
|
99
|
-
},
|
|
104
|
+
}, l = k(
|
|
100
105
|
this.getSortedPills(),
|
|
101
|
-
(
|
|
102
|
-
this.removePillAriaLabel ?? "Remove date"
|
|
106
|
+
(s) => I(s, (o) => R(o, this.localeId))
|
|
103
107
|
), n = {
|
|
104
108
|
"gui-widget-icon": !0,
|
|
105
109
|
[this.icon]: !!this.icon
|
|
@@ -113,19 +117,25 @@ let i = class extends v {
|
|
|
113
117
|
role="group"
|
|
114
118
|
aria-label=${this.label ?? "Date range input"}
|
|
115
119
|
>
|
|
116
|
-
${this.icon ? u`<span
|
|
120
|
+
${this.icon ? u`<span
|
|
121
|
+
class=${y(n)}
|
|
122
|
+
data-icon=${this.icon}
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
></span>` : p}
|
|
117
125
|
|
|
118
126
|
<gui-pills
|
|
119
127
|
class="gui-range-date-input__pills"
|
|
120
|
-
style=${
|
|
121
|
-
.
|
|
128
|
+
style=${G(l.length ? {} : { "min-width": 0 })}
|
|
129
|
+
.uid=${this.uid}
|
|
130
|
+
.toolbarAriaLabel=${"Selected date ranges"}
|
|
131
|
+
.items=${l}
|
|
122
132
|
.removable=${!0}
|
|
123
133
|
.clickable=${!0}
|
|
124
134
|
.bubble=${!0}
|
|
125
135
|
?disabled=${this.disabled}
|
|
126
136
|
?readonly=${this.readOnly}
|
|
127
137
|
.removeAriaLabel=${this.removePillAriaLabel ?? "Remove date"}
|
|
128
|
-
.compactAriaLabel=${`${
|
|
138
|
+
.compactAriaLabel=${`${l.length} date ranges`}
|
|
129
139
|
@pillremove=${this.onPillRemoveEvent}
|
|
130
140
|
@pillclick=${this.onPillClickEvent}
|
|
131
141
|
></gui-pills>
|
|
@@ -151,12 +161,12 @@ let i = class extends v {
|
|
|
151
161
|
</div>
|
|
152
162
|
</div>
|
|
153
163
|
|
|
154
|
-
${this.showErrors && this.errors?.length ?
|
|
164
|
+
${this.showErrors && this.errors?.length ? _(this.uid, t) : p}
|
|
155
165
|
</div>
|
|
156
166
|
`;
|
|
157
167
|
}
|
|
158
168
|
getSortedPills() {
|
|
159
|
-
return
|
|
169
|
+
return w(
|
|
160
170
|
this.value,
|
|
161
171
|
(t, e) => c(t).getTime() - c(e).getTime()
|
|
162
172
|
);
|
|
@@ -171,11 +181,11 @@ let i = class extends v {
|
|
|
171
181
|
);
|
|
172
182
|
}
|
|
173
183
|
validateDateParts(t) {
|
|
174
|
-
const { result: e, writeBacks:
|
|
184
|
+
const { result: e, writeBacks: l } = S(this._parts.values[t] ?? {}, {
|
|
175
185
|
descriptors: this.partDescriptors,
|
|
176
186
|
invalidDateMessage: this.invalidDateMessage
|
|
177
187
|
});
|
|
178
|
-
return this._parts.applyWriteBacks(t,
|
|
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" };
|
|
179
189
|
}
|
|
180
190
|
/**
|
|
181
191
|
* Re-parses both endpoints so per-endpoint problems (impossible date, out of
|
|
@@ -192,16 +202,16 @@ let i = class extends v {
|
|
|
192
202
|
* Shared by the Enter commit and by {@link revalidate}.
|
|
193
203
|
*/
|
|
194
204
|
evaluateRange() {
|
|
195
|
-
const { start: t, end: e } = this.syncParts(),
|
|
205
|
+
const { start: t, end: e } = this.syncParts(), l = O(t, e, this.value, {
|
|
196
206
|
// Swap if end < start
|
|
197
|
-
order: (n,
|
|
198
|
-
toRange: ({ start: n, end:
|
|
199
|
-
const o = g(n), d = g(
|
|
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);
|
|
200
210
|
return o === d ? { start: o } : { start: o, end: d };
|
|
201
211
|
},
|
|
202
|
-
merge:
|
|
212
|
+
merge: L
|
|
203
213
|
});
|
|
204
|
-
return
|
|
214
|
+
return l.kind === "invalid" && this._parts.surfaceInputError(l.message), l.kind === "incomplete" && this._parts.clearSurfacedInputError(this.value ?? []), l;
|
|
205
215
|
}
|
|
206
216
|
/**
|
|
207
217
|
* Once the user has attempted a commit, every later edit re-runs validation
|
|
@@ -235,58 +245,67 @@ let i = class extends v {
|
|
|
235
245
|
this._parts.clearGroup("start"), this._parts.clearGroup("end");
|
|
236
246
|
}
|
|
237
247
|
};
|
|
238
|
-
|
|
239
|
-
|
|
248
|
+
a([
|
|
249
|
+
r({ type: String })
|
|
240
250
|
], i.prototype, "uid", 2);
|
|
241
|
-
|
|
242
|
-
|
|
251
|
+
a([
|
|
252
|
+
r({ type: String })
|
|
243
253
|
], i.prototype, "label", 2);
|
|
244
|
-
|
|
245
|
-
|
|
254
|
+
a([
|
|
255
|
+
r({ type: String, attribute: "locale-id" })
|
|
246
256
|
], i.prototype, "localeId", 2);
|
|
247
|
-
|
|
248
|
-
|
|
257
|
+
a([
|
|
258
|
+
r({ type: Array })
|
|
249
259
|
], i.prototype, "errors", 2);
|
|
250
|
-
|
|
251
|
-
|
|
260
|
+
a([
|
|
261
|
+
r({ type: Boolean })
|
|
252
262
|
], i.prototype, "showErrors", 2);
|
|
253
|
-
|
|
254
|
-
|
|
263
|
+
a([
|
|
264
|
+
r({ type: Boolean })
|
|
255
265
|
], i.prototype, "touched", 2);
|
|
256
|
-
|
|
257
|
-
|
|
266
|
+
a([
|
|
267
|
+
r({ type: Boolean })
|
|
258
268
|
], i.prototype, "required", 2);
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
a([
|
|
270
|
+
r({ type: Boolean })
|
|
261
271
|
], i.prototype, "disabled", 2);
|
|
262
|
-
|
|
263
|
-
|
|
272
|
+
a([
|
|
273
|
+
r({ type: Boolean, attribute: "readonly" })
|
|
264
274
|
], i.prototype, "readOnly", 2);
|
|
265
|
-
|
|
266
|
-
|
|
275
|
+
a([
|
|
276
|
+
r({ type: String })
|
|
267
277
|
], i.prototype, "icon", 2);
|
|
268
|
-
|
|
269
|
-
|
|
278
|
+
a([
|
|
279
|
+
r({ type: String })
|
|
270
280
|
], i.prototype, "hint", 2);
|
|
271
|
-
|
|
272
|
-
|
|
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 })
|
|
273
292
|
], i.prototype, "value", 2);
|
|
274
|
-
|
|
275
|
-
|
|
293
|
+
a([
|
|
294
|
+
r({ type: String, attribute: "invalid-date-message" })
|
|
276
295
|
], i.prototype, "invalidDateMessage", 2);
|
|
277
|
-
|
|
278
|
-
|
|
296
|
+
a([
|
|
297
|
+
r({ type: String })
|
|
279
298
|
], i.prototype, "removePillAriaLabel", 2);
|
|
280
|
-
|
|
281
|
-
|
|
299
|
+
a([
|
|
300
|
+
r({ type: String })
|
|
282
301
|
], i.prototype, "startDateAriaLabel", 2);
|
|
283
|
-
|
|
284
|
-
|
|
302
|
+
a([
|
|
303
|
+
r({ type: String })
|
|
285
304
|
], i.prototype, "endDateAriaLabel", 2);
|
|
286
|
-
|
|
287
|
-
|
|
305
|
+
a([
|
|
306
|
+
r({ type: String })
|
|
288
307
|
], i.prototype, "separator", 2);
|
|
289
|
-
i =
|
|
308
|
+
i = a([
|
|
290
309
|
m("gui-range-date")
|
|
291
310
|
], i);
|
|
292
311
|
typeof customElements < "u" && !customElements.get("gui-range-date") && customElements.define("gui-range-date", i);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { InputWidgetAdapter as n, formContext as o, inputContext as
|
|
2
|
-
import "./range-date-input-
|
|
3
|
-
import { consume as
|
|
4
|
-
import { LitElement as c, html as
|
|
5
|
-
import { property as
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as o, inputContext as h } from "@golemui/lit";
|
|
2
|
+
import "./range-date-input-Br7XqQPK.js";
|
|
3
|
+
import { consume as u, provide as m } from "@lit/context";
|
|
4
|
+
import { LitElement as c, html as b } from "lit";
|
|
5
|
+
import { property as D, customElement as g } from "lit/decorators.js";
|
|
6
6
|
import "rxjs";
|
|
7
|
-
var
|
|
8
|
-
for (var a = r > 1 ? void 0 : r ?
|
|
7
|
+
var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, d = (t, e, s, r) => {
|
|
8
|
+
for (var a = r > 1 ? void 0 : r ? v(e, s) : e, p = t.length - 1, l; p >= 0; p--)
|
|
9
9
|
(l = t[p]) && (a = (r ? l(e, s, a) : l(a)) || a);
|
|
10
|
-
return r && a &&
|
|
10
|
+
return r && a && $(e, s, a), a;
|
|
11
11
|
};
|
|
12
12
|
let i = class extends c {
|
|
13
13
|
constructor() {
|
|
@@ -27,7 +27,7 @@ let i = class extends c {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
|
-
return super.render(),
|
|
30
|
+
return super.render(), b`
|
|
31
31
|
<gui-range-date
|
|
32
32
|
.uid=${this.widget.uid}
|
|
33
33
|
.label=${this.adapter.templateData.label}
|
|
@@ -40,6 +40,9 @@ let i = class extends c {
|
|
|
40
40
|
?readonly=${this.adapter.templateData.readonly}
|
|
41
41
|
.value=${this.adapter.templateData.value}
|
|
42
42
|
.localeId=${this.adapter.templateData.lang}
|
|
43
|
+
.dayAriaLabel=${this.adapter.templateData.dayAriaLabel}
|
|
44
|
+
.monthAriaLabel=${this.adapter.templateData.monthAriaLabel}
|
|
45
|
+
.yearAriaLabel=${this.adapter.templateData.yearAriaLabel}
|
|
43
46
|
.invalidDateMessage=${this.adapter.templateData.invalidDateMessage}
|
|
44
47
|
.separator=${this.adapter.templateData.separator}
|
|
45
48
|
.removePillAriaLabel=${this.adapter.templateData.removePillAriaLabel}
|
|
@@ -61,11 +64,11 @@ let i = class extends c {
|
|
|
61
64
|
}
|
|
62
65
|
};
|
|
63
66
|
d([
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
u({ context: o }),
|
|
68
|
+
D({ attribute: !1 })
|
|
66
69
|
], i.prototype, "formContext", 2);
|
|
67
70
|
d([
|
|
68
|
-
m({ context:
|
|
71
|
+
m({ context: h })
|
|
69
72
|
], i.prototype, "adapter", 2);
|
|
70
73
|
i = d([
|
|
71
74
|
g("gui-range-date-input")
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import { LitElement as c, html as h, nothing as
|
|
3
|
-
import { property as i, query as
|
|
4
|
-
import { classMap as
|
|
5
|
-
import "./range-date-input-
|
|
6
|
-
import "./range-calendar-
|
|
7
|
-
import { G as
|
|
8
|
-
import { r as
|
|
9
|
-
import { a as
|
|
10
|
-
import { consume as
|
|
1
|
+
import { InputWidgetAdapter as m, formContext as y, inputContext as v } from "@golemui/lit";
|
|
2
|
+
import { LitElement as c, html as h, nothing as $ } from "lit";
|
|
3
|
+
import { property as i, query as D, state as g, customElement as b } from "lit/decorators.js";
|
|
4
|
+
import { classMap as A } from "lit/directives/class-map.js";
|
|
5
|
+
import "./range-date-input-Br7XqQPK.js";
|
|
6
|
+
import "./range-calendar-DO_woqcF.js";
|
|
7
|
+
import { G as f } from "./popup.controller-B33OvX_y.js";
|
|
8
|
+
import { r as L, D as M, d as _ } from "./date-DBuYpvcO.js";
|
|
9
|
+
import { a as w, b as x, c as C } from "./templates-Dmr34nwp.js";
|
|
10
|
+
import { consume as R, provide as S } from "@lit/context";
|
|
11
11
|
import "rxjs";
|
|
12
|
-
var
|
|
13
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
14
|
-
(
|
|
15
|
-
return s && o &&
|
|
12
|
+
var E = Object.defineProperty, I = Object.getOwnPropertyDescriptor, a = (e, r, n, s) => {
|
|
13
|
+
for (var o = s > 1 ? void 0 : s ? I(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 && E(r, n, o), o;
|
|
16
16
|
};
|
|
17
17
|
let t = class extends c {
|
|
18
18
|
constructor() {
|
|
19
|
-
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.separator = void 0, this.removePillAriaLabel = void 0, this.startDateAriaLabel = void 0, this.endDateAriaLabel = void 0, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = void 0, this.nextMonthAriaLabel = 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._focusDate = void 0, this._invalidRange = null, this._popup = new
|
|
20
|
-
getInteriorElements: () => [this._dateRef, this._calendarRef],
|
|
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 = [], this.separator = void 0, this.removePillAriaLabel = void 0, this.startDateAriaLabel = void 0, this.endDateAriaLabel = 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._focusDate = void 0, this._invalidRange = null, this._popup = new f(this, {
|
|
21
20
|
focusRestoreSelector: "gui-range-date input",
|
|
21
|
+
focusPopupSelector: '.gui-calendar__day-button[tabindex="0"]',
|
|
22
22
|
isDisabled: () => !!this.disabled,
|
|
23
23
|
clickIntent: (e) => e.closest(".gui-range-date-input__part") || e.closest("gui-range-calendar") ? "open" : "toggle",
|
|
24
24
|
keyToggleMode: "openClose",
|
|
@@ -27,6 +27,8 @@ let t = class extends c {
|
|
|
27
27
|
}
|
|
28
28
|
}), this.onDropdownToggle = (e) => {
|
|
29
29
|
e.detail?.open && this._popup.open && this._popup.close();
|
|
30
|
+
}, this.onToggleClick = (e) => {
|
|
31
|
+
e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
createRenderRoot() {
|
|
@@ -39,8 +41,10 @@ let t = class extends c {
|
|
|
39
41
|
super.disconnectedCallback(), this.removeEventListener("dropdowntoggle", this.onDropdownToggle);
|
|
40
42
|
}
|
|
41
43
|
render() {
|
|
42
|
-
const e =
|
|
43
|
-
id
|
|
44
|
+
const e = w("datePicker", { icon: this.icon }), r = this._popup.open ? h`<gui-range-calendar
|
|
45
|
+
id=${`${this.uid}_popup`}
|
|
46
|
+
role="dialog"
|
|
47
|
+
aria-label=${this.label ?? "Calendar"}
|
|
44
48
|
.uid=${this.uid}
|
|
45
49
|
.hint=${this.hint}
|
|
46
50
|
?touched=${this.touched}
|
|
@@ -53,6 +57,8 @@ let t = class extends c {
|
|
|
53
57
|
.nextMonthIcon=${this.nextMonthIcon}
|
|
54
58
|
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
55
59
|
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
60
|
+
.selectYearAriaLabel=${this.selectYearAriaLabel}
|
|
61
|
+
.yearGridAriaLabel=${this.yearGridAriaLabel}
|
|
56
62
|
.dayFormat=${this.dayFormat}
|
|
57
63
|
.weekdayFormat=${this.weekdayFormat}
|
|
58
64
|
.monthFormat=${this.monthFormat}
|
|
@@ -67,26 +73,28 @@ let t = class extends c {
|
|
|
67
73
|
@blur=${this.onCalendarBlur}
|
|
68
74
|
@change=${this.onCalendarChange}
|
|
69
75
|
@inputError=${this.onCalendarInputError}
|
|
70
|
-
></gui-range-calendar>` :
|
|
76
|
+
></gui-range-calendar>` : $;
|
|
71
77
|
return h`
|
|
72
|
-
${
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
${x(
|
|
79
|
+
this.uid ?? "",
|
|
80
|
+
{
|
|
81
|
+
label: this.label,
|
|
82
|
+
hint: this.hint,
|
|
83
|
+
required: this.required
|
|
84
|
+
},
|
|
85
|
+
!1,
|
|
86
|
+
void 0,
|
|
87
|
+
!1
|
|
88
|
+
)}
|
|
77
89
|
|
|
78
90
|
<div
|
|
79
|
-
role="button"
|
|
80
|
-
tabindex="-1"
|
|
81
91
|
class="gui-widget"
|
|
82
|
-
aria-expanded=${this._popup.open}
|
|
83
|
-
@keyup=${this._popup.onAnchorKeyUp}
|
|
84
92
|
@keydown=${this._popup.onAnchorKeyDown}
|
|
85
93
|
@click=${this._popup.onAnchorClick}
|
|
86
94
|
>
|
|
87
95
|
<gui-range-date
|
|
88
96
|
id="date-input"
|
|
89
|
-
class=${
|
|
97
|
+
class=${A(e.widgetClasses)}
|
|
90
98
|
.uid=${this.uid}
|
|
91
99
|
.hint=${this.hint}
|
|
92
100
|
.showErrors=${!1}
|
|
@@ -102,18 +110,37 @@ let t = class extends c {
|
|
|
102
110
|
.removePillAriaLabel=${this.removePillAriaLabel}
|
|
103
111
|
.startDateAriaLabel=${this.startDateAriaLabel}
|
|
104
112
|
.endDateAriaLabel=${this.endDateAriaLabel}
|
|
113
|
+
.dayAriaLabel=${this.dayAriaLabel}
|
|
114
|
+
.monthAriaLabel=${this.monthAriaLabel}
|
|
115
|
+
.yearAriaLabel=${this.yearAriaLabel}
|
|
105
116
|
.invalidDateMessage=${this.invalidDateMessage}
|
|
106
117
|
@blur=${this.onDateBlur}
|
|
107
118
|
@focus=${this._popup.show}
|
|
108
119
|
@change=${this.onDateChange}
|
|
109
120
|
@pillClick=${this.onPillClick}
|
|
110
121
|
></gui-range-date>
|
|
111
|
-
<
|
|
112
|
-
|
|
122
|
+
<button
|
|
123
|
+
type="button"
|
|
124
|
+
class="gui-range-date-picker__arrow"
|
|
125
|
+
aria-label=${this.toggleAriaLabel ?? "Show calendar"}
|
|
126
|
+
aria-haspopup="dialog"
|
|
127
|
+
aria-expanded=${this._popup.open ? "true" : "false"}
|
|
128
|
+
aria-controls=${`${this.uid}_popup`}
|
|
129
|
+
?disabled=${this.disabled}
|
|
130
|
+
@click=${this.onToggleClick}
|
|
131
|
+
>
|
|
132
|
+
<svg
|
|
133
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
134
|
+
width="16"
|
|
135
|
+
height="16"
|
|
136
|
+
viewBox="0 0 256 256"
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
>
|
|
113
139
|
<path
|
|
114
140
|
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"
|
|
115
|
-
></path
|
|
116
|
-
|
|
141
|
+
></path>
|
|
142
|
+
</svg>
|
|
143
|
+
</button>
|
|
117
144
|
|
|
118
145
|
${r}
|
|
119
146
|
</div>
|
|
@@ -136,15 +163,15 @@ let t = class extends c {
|
|
|
136
163
|
/** The message for the first constraint a range violates, or null when valid. */
|
|
137
164
|
rangeError(e) {
|
|
138
165
|
const r = e.start, n = e.end ?? e.start;
|
|
139
|
-
if (
|
|
140
|
-
return this.disabledDateRangeMessage ??
|
|
166
|
+
if (L(r, n, this.disabledRanges))
|
|
167
|
+
return this.disabledDateRangeMessage ?? M;
|
|
141
168
|
const s = {
|
|
142
169
|
minDateMessage: this.minDateMessage,
|
|
143
170
|
maxDateMessage: this.maxDateMessage
|
|
144
171
|
};
|
|
145
172
|
for (const o of [r, n]) {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
173
|
+
const l = _(o, this.minDate, this.maxDate, void 0, s);
|
|
174
|
+
if (l) return l;
|
|
148
175
|
}
|
|
149
176
|
return null;
|
|
150
177
|
}
|
|
@@ -180,7 +207,7 @@ let t = class extends c {
|
|
|
180
207
|
);
|
|
181
208
|
}
|
|
182
209
|
onCalendarBlur() {
|
|
183
|
-
this._popup.
|
|
210
|
+
this._popup.closeOnFocusLeave();
|
|
184
211
|
}
|
|
185
212
|
onPillClick(e) {
|
|
186
213
|
this._focusDate = e.detail.range.start, this._popup.show();
|
|
@@ -201,6 +228,18 @@ a([
|
|
|
201
228
|
a([
|
|
202
229
|
i({ type: String })
|
|
203
230
|
], t.prototype, "icon", 2);
|
|
231
|
+
a([
|
|
232
|
+
i({ type: String, attribute: "toggle-aria-label" })
|
|
233
|
+
], t.prototype, "toggleAriaLabel", 2);
|
|
234
|
+
a([
|
|
235
|
+
i({ type: String })
|
|
236
|
+
], t.prototype, "dayAriaLabel", 2);
|
|
237
|
+
a([
|
|
238
|
+
i({ type: String })
|
|
239
|
+
], t.prototype, "monthAriaLabel", 2);
|
|
240
|
+
a([
|
|
241
|
+
i({ type: String })
|
|
242
|
+
], t.prototype, "yearAriaLabel", 2);
|
|
204
243
|
a([
|
|
205
244
|
i({ type: Array })
|
|
206
245
|
], t.prototype, "errors", 2);
|
|
@@ -249,6 +288,12 @@ a([
|
|
|
249
288
|
a([
|
|
250
289
|
i({ type: String, attribute: "next-month-aria-label" })
|
|
251
290
|
], t.prototype, "nextMonthAriaLabel", 2);
|
|
291
|
+
a([
|
|
292
|
+
i({ type: String, attribute: "select-year-aria-label" })
|
|
293
|
+
], t.prototype, "selectYearAriaLabel", 2);
|
|
294
|
+
a([
|
|
295
|
+
i({ type: String, attribute: "year-grid-aria-label" })
|
|
296
|
+
], t.prototype, "yearGridAriaLabel", 2);
|
|
252
297
|
a([
|
|
253
298
|
i({ type: String, attribute: "day-format" })
|
|
254
299
|
], t.prototype, "dayFormat", 2);
|
|
@@ -283,29 +328,26 @@ a([
|
|
|
283
328
|
i({ type: String, attribute: "disabled-date-range-message" })
|
|
284
329
|
], t.prototype, "disabledDateRangeMessage", 2);
|
|
285
330
|
a([
|
|
286
|
-
|
|
331
|
+
D("#date-input")
|
|
287
332
|
], t.prototype, "_dateRef", 2);
|
|
288
333
|
a([
|
|
289
|
-
g(
|
|
290
|
-
], t.prototype, "_calendarRef", 2);
|
|
291
|
-
a([
|
|
292
|
-
m()
|
|
334
|
+
g()
|
|
293
335
|
], t.prototype, "_focusDate", 2);
|
|
294
336
|
a([
|
|
295
|
-
|
|
337
|
+
g()
|
|
296
338
|
], t.prototype, "_invalidRange", 2);
|
|
297
339
|
t = a([
|
|
298
340
|
b("gui-range-date-picker")
|
|
299
341
|
], t);
|
|
300
342
|
typeof customElements < "u" && !customElements.get("gui-range-date-picker") && customElements.define("gui-range-date-picker", t);
|
|
301
343
|
var P = Object.defineProperty, k = Object.getOwnPropertyDescriptor, u = (e, r, n, s) => {
|
|
302
|
-
for (var o = s > 1 ? void 0 : s ? k(r, n) : r,
|
|
303
|
-
(
|
|
344
|
+
for (var o = s > 1 ? void 0 : s ? k(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
345
|
+
(d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
|
|
304
346
|
return s && o && P(r, n, o), o;
|
|
305
347
|
};
|
|
306
348
|
let p = class extends c {
|
|
307
349
|
constructor() {
|
|
308
|
-
super(...arguments), this.adapter = new
|
|
350
|
+
super(...arguments), this.adapter = new m(), this.subscriptions = [];
|
|
309
351
|
}
|
|
310
352
|
createRenderRoot() {
|
|
311
353
|
return this;
|
|
@@ -336,6 +378,10 @@ let p = class extends c {
|
|
|
336
378
|
.value=${e.value}
|
|
337
379
|
.icon=${e.icon}
|
|
338
380
|
.localeId=${e.lang}
|
|
381
|
+
.toggleAriaLabel=${e.toggleAriaLabel}
|
|
382
|
+
.dayAriaLabel=${e.dayAriaLabel}
|
|
383
|
+
.monthAriaLabel=${e.monthAriaLabel}
|
|
384
|
+
.yearAriaLabel=${e.yearAriaLabel}
|
|
339
385
|
.separator=${e.separator}
|
|
340
386
|
.removePillAriaLabel=${e.removePillAriaLabel}
|
|
341
387
|
.startDateAriaLabel=${e.startDateAriaLabel}
|
|
@@ -344,6 +390,8 @@ let p = class extends c {
|
|
|
344
390
|
.nextMonthIcon=${e.nextMonthIcon}
|
|
345
391
|
.prevMonthAriaLabel=${e.prevMonthAriaLabel}
|
|
346
392
|
.nextMonthAriaLabel=${e.nextMonthAriaLabel}
|
|
393
|
+
.selectYearAriaLabel=${e.selectYearAriaLabel}
|
|
394
|
+
.yearGridAriaLabel=${e.yearGridAriaLabel}
|
|
347
395
|
.dayFormat=${e.dayFormat}
|
|
348
396
|
.weekdayFormat=${e.weekdayFormat}
|
|
349
397
|
.monthFormat=${e.monthFormat}
|
|
@@ -372,11 +420,11 @@ let p = class extends c {
|
|
|
372
420
|
}
|
|
373
421
|
};
|
|
374
422
|
u([
|
|
375
|
-
|
|
423
|
+
R({ context: y }),
|
|
376
424
|
i({ attribute: !1 })
|
|
377
425
|
], p.prototype, "formContext", 2);
|
|
378
426
|
u([
|
|
379
|
-
|
|
427
|
+
S({ context: v })
|
|
380
428
|
], p.prototype, "adapter", 2);
|
|
381
429
|
p = u([
|
|
382
430
|
b("gui-range-date-picker-input")
|