@golemui/gui-lit 1.0.3 → 1.1.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 +11 -0
- package/calendar-BuJgwvZx.js +254 -0
- package/{calendar.element-DcnTyvfg.js → calendar.element-M5MPJmap.js} +1 -1
- package/{currency.element-5GSakkxF.js → currency.element-CfFrAtrr.js} +4 -1
- package/{date-CDUlLuYy.js → date-Bj9mI3GU.js} +80 -29
- package/date-input-cJDkNnVw.js +184 -0
- package/date-picker.element-va_-LGZD.js +312 -0
- package/date-time-calendar-BzRfkLKU.js +361 -0
- package/date-time-calendar.element-DC4NK0y1.js +93 -0
- package/date-time-input-BXxsfuyZ.js +214 -0
- package/date-time-picker.element-Dy-8cb-_.js +380 -0
- package/date-time.element-Bv4XdzMi.js +87 -0
- package/{date.element-BZO0UQez.js → date.element-Consgsbb.js} +32 -27
- package/day-status-0-hJHrI7.js +530 -0
- package/{dropdown.element-CyJbVAA5.js → dropdown.element-WsD61Qel.js} +46 -36
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1199 -971
- package/index.umd.cjs +1582 -530
- package/lib/components/date-picker.element.d.ts +0 -11
- package/lib/components/date-time-calendar.element.d.ts +18 -0
- package/lib/components/date-time-picker.element.d.ts +18 -0
- package/lib/components/date-time.element.d.ts +18 -0
- package/lib/components/dropdown.element.d.ts +2 -0
- package/lib/components/range-calendar.element.d.ts +2 -1
- package/lib/components/range-date-picker.element.d.ts +0 -15
- package/lib/components/range-date-time-calendar.element.d.ts +18 -0
- package/lib/components/range-date-time-input.element.d.ts +18 -0
- package/lib/components/range-date-time-picker.element.d.ts +18 -0
- package/lib/components/range-time-input.element.d.ts +18 -0
- package/lib/components/range-time-picker.element.d.ts +18 -0
- package/lib/components/time-picker.element.d.ts +18 -0
- package/lib/components/time.element.d.ts +18 -0
- package/{list-D1oKnH89.js → list-CrLIL4by.js} +76 -61
- package/{list.element-Co3V3Cn5.js → list.element-DV82YxnJ.js} +22 -22
- package/package.json +6 -6
- package/part-templates-Db871PS3.js +677 -0
- package/pill-ranges-DCqDmpkk.js +48 -0
- package/{pills-B66qz_KX.js → pills-Be1UrLgq.js} +4 -1
- package/popup.controller-eUDxE6jD.js +71 -0
- package/range-calendar-CKPYeSGt.js +452 -0
- package/{range-calendar.element-_1bHW_c1.js → range-calendar.element-D6KYq18B.js} +24 -20
- package/range-commit-8-MmYUyo.js +14 -0
- package/range-date-input-D--AqBMv.js +292 -0
- package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-D4nIXJbw.js} +8 -7
- package/range-date-picker.element-dhxPAAE6.js +386 -0
- package/range-date-time-calendar-yksWrR7b.js +720 -0
- package/range-date-time-calendar.element-C00aDefZ.js +95 -0
- package/range-date-time-input-B37TUoM3.js +322 -0
- package/range-date-time-input.element-DUnbv4ed.js +81 -0
- package/range-date-time-picker.element-Cbps6s_G.js +412 -0
- package/range-selection-CU3hxLJE.js +25 -0
- package/range-time-input-3lhqR1Ku.js +329 -0
- package/range-time-input.element-dU2iBdmJ.js +81 -0
- package/range-time-picker.element-v6nQsIPw.js +429 -0
- package/{select.element-jcDF1h-g.js → select.element-C0V-Bv3L.js} +94 -90
- package/{tags.element-CX3vQL8L.js → tags.element-DvwEpxpK.js} +1 -1
- package/time-input-BOhlBGJZ.js +181 -0
- package/time-list-Czo48bZm.js +217 -0
- package/time-picker-bFJ63ky8.js +261 -0
- package/time-picker.element-CYZVXgRS.js +85 -0
- package/time.element-fK3oLi49.js +82 -0
- package/abstract-calendar-D0-077XJ.js +0 -545
- package/calendar-BclCC9VJ.js +0 -96
- package/date-input-DCdGWRio.js +0 -268
- package/date-picker.element-k7AJFQ5W.js +0 -168
- package/range-calendar-CBINu84w.js +0 -255
- package/range-date-input-BYXzqnr1.js +0 -395
- package/range-date-picker.element-BCBefgvY.js +0 -182
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 1.0.3 (2026-07-02)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- firefox issues with date inputs, numeric inputs and dropdown ([#215](https://github.com/golemui/golemui/pull/215))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Mud Scientist @mudscientist
|
|
10
|
+
- Raúl Jiménez @Elecash
|
|
11
|
+
|
|
1
12
|
## 1.0.2 (2026-06-26)
|
|
2
13
|
|
|
3
14
|
This was a version bump only for gui-lit to align it with other projects, there were no code changes.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { LitElement as u, html as p, nothing as y } from "lit";
|
|
2
|
+
import { property as o, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
4
|
+
import { G as m } from "./templates-Dk1jxLwS.js";
|
|
5
|
+
import { G as g, a as D, r as M, c as _, d as S, b as f, e as C } from "./day-status-0-hJHrI7.js";
|
|
6
|
+
import { G as O } from "./focus-leave.controller-2gV0pQd5.js";
|
|
7
|
+
import { p as d, f as I, h as x, t as c } from "./date-Bj9mI3GU.js";
|
|
8
|
+
var L = Object.defineProperty, G = Object.getOwnPropertyDescriptor, a = (e, t, n, i) => {
|
|
9
|
+
for (var s = i > 1 ? void 0 : i ? G(t, n) : t, l = e.length - 1, h; l >= 0; l--)
|
|
10
|
+
(h = e[l]) && (s = (i ? h(t, n, s) : h(s)) || s);
|
|
11
|
+
return i && s && L(t, n, s), s;
|
|
12
|
+
};
|
|
13
|
+
let r = class extends u {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = void 0, this.errors = [], this.touched = void 0, this.required = !1, this.disabled = !1, this.readOnly = !1, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = "", this.nextMonthAriaLabel = "", this.dayFormat = "numeric", this.weekdayFormat = "narrow", this.monthFormat = "long", this.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = 1, this.value = void 0, this._nav = new g(this, {
|
|
16
|
+
getMinDate: () => this.minDate,
|
|
17
|
+
getMaxDate: () => this.maxDate,
|
|
18
|
+
getNumberOfMonths: () => this.numberOfMonths,
|
|
19
|
+
getDisabledRanges: () => this.disabledRanges,
|
|
20
|
+
onYearSelectorToggled: () => this._keyboard.onYearGridToggled()
|
|
21
|
+
}), this.ariaController = new m(this, {
|
|
22
|
+
getTargets: () => this.querySelectorAll(".gui-calendar-input"),
|
|
23
|
+
getState: () => ({
|
|
24
|
+
uid: this.uid,
|
|
25
|
+
templateData: {
|
|
26
|
+
hint: this.hint,
|
|
27
|
+
errors: this.errors,
|
|
28
|
+
readonly: this.readOnly,
|
|
29
|
+
disabled: this.disabled,
|
|
30
|
+
touched: this.touched
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}), this._keyboard = new D(this, {
|
|
34
|
+
canGoPrev: () => this._nav.canGoPrev(),
|
|
35
|
+
canGoNext: () => this._nav.canGoNext(),
|
|
36
|
+
goPrev: () => this._nav.prevMonth(),
|
|
37
|
+
goNext: () => this._nav.nextMonth(),
|
|
38
|
+
// Enter/Space can only fire on a focused (hence enabled, in-month) day
|
|
39
|
+
// button; the `disabled`/`readOnly` host guards stay inside `selectDate`.
|
|
40
|
+
onActivateDay: (e) => {
|
|
41
|
+
const t = d(e);
|
|
42
|
+
this.selectDate({
|
|
43
|
+
date: t,
|
|
44
|
+
dayLabel: x(this.localeId, t),
|
|
45
|
+
isCurrentMonth: !0,
|
|
46
|
+
isToday: I(t),
|
|
47
|
+
isSelected: !1,
|
|
48
|
+
isFocusable: !0,
|
|
49
|
+
isDisabled: !1
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
onSelectYear: (e) => this._nav.selectYear(e),
|
|
53
|
+
onCloseYearGrid: () => this._nav.closeYearSelector(),
|
|
54
|
+
isYearGridOpen: () => this._nav.yearSelectorOpen
|
|
55
|
+
}), this._focusLeave = new O(this, {
|
|
56
|
+
onLeave: () => {
|
|
57
|
+
this.dispatchEvent(new CustomEvent("blur", { bubbles: !0, composed: !0 }));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** The nav controller's month cursor, kept under its historical name. */
|
|
62
|
+
get _currentDate() {
|
|
63
|
+
return this._nav.currentDate;
|
|
64
|
+
}
|
|
65
|
+
set _currentDate(e) {
|
|
66
|
+
this._nav.currentDate = e;
|
|
67
|
+
}
|
|
68
|
+
createRenderRoot() {
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
connectedCallback() {
|
|
72
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
73
|
+
}
|
|
74
|
+
willUpdate(e) {
|
|
75
|
+
e.has("value") && this.value && this._nav.navigateToDate(d(this.value));
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
return M({
|
|
79
|
+
uid: this.uid,
|
|
80
|
+
label: this.label,
|
|
81
|
+
hint: this.hint,
|
|
82
|
+
errors: this.errors,
|
|
83
|
+
touched: this.touched,
|
|
84
|
+
required: this.required,
|
|
85
|
+
disabled: this.disabled,
|
|
86
|
+
numberOfMonths: this.numberOfMonths,
|
|
87
|
+
prevMonthIcon: this.prevMonthIcon,
|
|
88
|
+
nextMonthIcon: this.nextMonthIcon,
|
|
89
|
+
prevMonthAriaLabel: this.prevMonthAriaLabel,
|
|
90
|
+
nextMonthAriaLabel: this.nextMonthAriaLabel,
|
|
91
|
+
canGoPrev: this._nav.canGoPrev(),
|
|
92
|
+
canGoNext: this._nav.canGoNext(),
|
|
93
|
+
onPrevMonthClick: this._keyboard.onPrevMonthClick,
|
|
94
|
+
onNextMonthClick: this._keyboard.onNextMonthClick,
|
|
95
|
+
onFocusOut: this._focusLeave.onFocusOut,
|
|
96
|
+
renderAboveCalendar: () => y,
|
|
97
|
+
renderMonthPanel: (e) => f({
|
|
98
|
+
currentDate: this._nav.currentDate,
|
|
99
|
+
offset: e,
|
|
100
|
+
localeId: this.localeId,
|
|
101
|
+
monthFormat: this.monthFormat,
|
|
102
|
+
yearSelectorOpen: this._nav.yearSelectorOpen,
|
|
103
|
+
onToggleYearSelector: () => this._nav.toggleYearSelector(),
|
|
104
|
+
renderPanelBody: (t) => this.renderPanelBody(t)
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The panel content below the header: the year grid replaces the days grid
|
|
110
|
+
* of the first panel while the year selector is open. Subclasses can swap
|
|
111
|
+
* in other bodies (e.g. the date-time calendar's time grid).
|
|
112
|
+
*/
|
|
113
|
+
renderPanelBody(e) {
|
|
114
|
+
return _({
|
|
115
|
+
offset: e,
|
|
116
|
+
yearSelectorOpen: this._nav.yearSelectorOpen,
|
|
117
|
+
years: this._nav.yearList,
|
|
118
|
+
currentYear: this._nav.currentDate.getFullYear(),
|
|
119
|
+
onSelectYear: (t) => this._keyboard.selectYear(t),
|
|
120
|
+
onYearKeydown: this._keyboard.handleYearKeydown,
|
|
121
|
+
localeId: this.localeId,
|
|
122
|
+
getDays: (t) => this.getDaysInMonth(t),
|
|
123
|
+
renderDay: (t) => this.renderDay(t)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
renderDay(e) {
|
|
127
|
+
const t = {
|
|
128
|
+
"gui-calendar__day-button": !0,
|
|
129
|
+
today: e.isToday,
|
|
130
|
+
selected: e.isSelected,
|
|
131
|
+
disabled: e.isDisabled,
|
|
132
|
+
"other-month": !e.isCurrentMonth
|
|
133
|
+
};
|
|
134
|
+
return p`
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
role="gridcell"
|
|
138
|
+
class=${v(t)}
|
|
139
|
+
tabindex=${e.isFocusable ? 0 : -1}
|
|
140
|
+
?disabled=${!e.isCurrentMonth || e.isDisabled}
|
|
141
|
+
data-date=${c(e.date)}
|
|
142
|
+
@click=${() => this.selectDate(e)}
|
|
143
|
+
@keydown=${(n) => this._keyboard.handleDayKeydown(n)}
|
|
144
|
+
aria-selected=${e.isSelected}
|
|
145
|
+
>
|
|
146
|
+
${e.dayLabel}
|
|
147
|
+
</button>
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
getDaysInMonth(e) {
|
|
151
|
+
const t = this.value;
|
|
152
|
+
return S({
|
|
153
|
+
currentDate: this._currentDate,
|
|
154
|
+
offset: e,
|
|
155
|
+
localeId: this.localeId,
|
|
156
|
+
numberOfMonths: this.numberOfMonths ?? 1,
|
|
157
|
+
isDisabled: (n) => this.isDisabled(n),
|
|
158
|
+
toDay: (n) => {
|
|
159
|
+
const i = C(n.date, { selectedISO: t }).isSelected;
|
|
160
|
+
return {
|
|
161
|
+
date: n.date,
|
|
162
|
+
dayLabel: n.dayLabel,
|
|
163
|
+
isCurrentMonth: n.isCurrentMonth,
|
|
164
|
+
isToday: n.isToday,
|
|
165
|
+
isDisabled: n.isDisabled,
|
|
166
|
+
isSelected: i,
|
|
167
|
+
isFocusable: (i || n.isToday) && n.isCurrentMonth
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
focusFallbackDates: [t ? d(t) : /* @__PURE__ */ new Date()]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
selectDate(e) {
|
|
174
|
+
if (!e.isCurrentMonth || e.isDisabled || this.disabled || this.readOnly) return;
|
|
175
|
+
const t = c(e.date);
|
|
176
|
+
this.value = t, this.dispatchEvent(
|
|
177
|
+
new CustomEvent("change", {
|
|
178
|
+
detail: { value: t },
|
|
179
|
+
bubbles: !0,
|
|
180
|
+
composed: !0
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
isDisabled(e) {
|
|
185
|
+
return this._nav.isDisabled(e);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
a([
|
|
189
|
+
o({ type: String })
|
|
190
|
+
], r.prototype, "uid", 2);
|
|
191
|
+
a([
|
|
192
|
+
o({ type: String })
|
|
193
|
+
], r.prototype, "label", 2);
|
|
194
|
+
a([
|
|
195
|
+
o({ type: String })
|
|
196
|
+
], r.prototype, "hint", 2);
|
|
197
|
+
a([
|
|
198
|
+
o({ type: String, attribute: "locale-id" })
|
|
199
|
+
], r.prototype, "localeId", 2);
|
|
200
|
+
a([
|
|
201
|
+
o({ type: Array })
|
|
202
|
+
], r.prototype, "errors", 2);
|
|
203
|
+
a([
|
|
204
|
+
o({ type: Boolean })
|
|
205
|
+
], r.prototype, "touched", 2);
|
|
206
|
+
a([
|
|
207
|
+
o({ type: Boolean })
|
|
208
|
+
], r.prototype, "required", 2);
|
|
209
|
+
a([
|
|
210
|
+
o({ type: Boolean })
|
|
211
|
+
], r.prototype, "disabled", 2);
|
|
212
|
+
a([
|
|
213
|
+
o({ type: Boolean, attribute: "readonly" })
|
|
214
|
+
], r.prototype, "readOnly", 2);
|
|
215
|
+
a([
|
|
216
|
+
o({ type: String, attribute: "prev-month-icon" })
|
|
217
|
+
], r.prototype, "prevMonthIcon", 2);
|
|
218
|
+
a([
|
|
219
|
+
o({ type: String, attribute: "next-month-icon" })
|
|
220
|
+
], r.prototype, "nextMonthIcon", 2);
|
|
221
|
+
a([
|
|
222
|
+
o({ type: String, attribute: "prev-month-aria-label" })
|
|
223
|
+
], r.prototype, "prevMonthAriaLabel", 2);
|
|
224
|
+
a([
|
|
225
|
+
o({ type: String, attribute: "next-month-aria-label" })
|
|
226
|
+
], r.prototype, "nextMonthAriaLabel", 2);
|
|
227
|
+
a([
|
|
228
|
+
o({ type: String })
|
|
229
|
+
], r.prototype, "dayFormat", 2);
|
|
230
|
+
a([
|
|
231
|
+
o({ type: String })
|
|
232
|
+
], r.prototype, "weekdayFormat", 2);
|
|
233
|
+
a([
|
|
234
|
+
o({ type: String })
|
|
235
|
+
], r.prototype, "monthFormat", 2);
|
|
236
|
+
a([
|
|
237
|
+
o({ type: String })
|
|
238
|
+
], r.prototype, "minDate", 2);
|
|
239
|
+
a([
|
|
240
|
+
o({ type: String })
|
|
241
|
+
], r.prototype, "maxDate", 2);
|
|
242
|
+
a([
|
|
243
|
+
o({ type: Array })
|
|
244
|
+
], r.prototype, "disabledRanges", 2);
|
|
245
|
+
a([
|
|
246
|
+
o({ type: Number })
|
|
247
|
+
], r.prototype, "numberOfMonths", 2);
|
|
248
|
+
a([
|
|
249
|
+
o({ type: String })
|
|
250
|
+
], r.prototype, "value", 2);
|
|
251
|
+
r = a([
|
|
252
|
+
b("gui-calendar")
|
|
253
|
+
], r);
|
|
254
|
+
typeof customElements < "u" && !customElements.get("gui-calendar") && customElements.define("gui-calendar", r);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputWidgetAdapter as o, formContext as l, inputContext as h } from "@golemui/lit";
|
|
2
|
-
import "./calendar-
|
|
2
|
+
import "./calendar-BuJgwvZx.js";
|
|
3
3
|
import { consume as m, provide as u } from "@lit/context";
|
|
4
4
|
import { LitElement as c, html as D } from "lit";
|
|
5
5
|
import { property as b, customElement as $ } from "lit/decorators.js";
|
|
@@ -122,7 +122,10 @@ let i = class extends m {
|
|
|
122
122
|
formatCurrency(t) {
|
|
123
123
|
if (t === "" || t === void 0 || t === null || isNaN(t)) return "";
|
|
124
124
|
try {
|
|
125
|
-
const e = this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 2, 2), o = Math.min(
|
|
125
|
+
const e = this.maximumFractionDigits ?? Math.max(this.minimumFractionDigits ?? 2, 2), o = Math.min(
|
|
126
|
+
this.minimumFractionDigits ?? 2,
|
|
127
|
+
e
|
|
128
|
+
);
|
|
126
129
|
return new Intl.NumberFormat(this.localeId ?? "en", {
|
|
127
130
|
style: "currency",
|
|
128
131
|
currency: this.currency ?? "USD",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = {
|
|
2
2
|
aa: { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
3
3
|
"aa-DJ": { firstDay: 6, weekend: [6, 7], minimalDays: 1 },
|
|
4
4
|
"aa-ER": { firstDay: 1, weekend: [6, 7], minimalDays: 1 },
|
|
@@ -709,8 +709,8 @@ const r = {
|
|
|
709
709
|
"zh-Hant-HK": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
710
710
|
"zh-Hant-MO": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
711
711
|
zu: { firstDay: 7, weekend: [6, 7], minimalDays: 1 }
|
|
712
|
-
};
|
|
713
|
-
function
|
|
712
|
+
}, M = "Invalid date: day is greater than the maximum valid day for the month and year.", k = "Invalid date: date is before the minimum allowed date.", w = "Invalid date: date is after the maximum allowed date.", o = "Invalid date: date is within a disabled range.", I = "Invalid time: time is before the minimum allowed time.", S = "Invalid time: time is after the maximum allowed time.", E = "Invalid range: end time must be after start time.", h = "Invalid time: time is within a disabled range.", b = "Invalid date-time: date-time is before the minimum allowed date-time.", L = "Invalid date-time: date-time is after the maximum allowed date-time.";
|
|
713
|
+
function r(e) {
|
|
714
714
|
const a = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0");
|
|
715
715
|
return `${a}-${n}-${i}`;
|
|
716
716
|
}
|
|
@@ -718,28 +718,66 @@ function t(e) {
|
|
|
718
718
|
const a = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
719
719
|
return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3])) : new Date(e);
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
721
|
+
function d(e, a, n, i) {
|
|
722
|
+
const s = e.split("T")[0];
|
|
723
|
+
if (a && s < a.split("T")[0] || n && s > n.split("T")[0]) return !0;
|
|
724
|
+
if (i && i.length > 0)
|
|
725
|
+
for (const m of i) {
|
|
726
|
+
const D = m.start.split("T")[0], y = m.end ? m.end.split("T")[0] : D;
|
|
727
|
+
if (s >= D && s <= y)
|
|
728
|
+
return !0;
|
|
729
|
+
}
|
|
730
|
+
return !1;
|
|
731
|
+
}
|
|
732
|
+
function G(e, a, n, i, s) {
|
|
733
|
+
const m = e.split("T")[0];
|
|
734
|
+
return a && m < a.split("T")[0] ? s?.minDateMessage ?? k : n && m > n.split("T")[0] ? s?.maxDateMessage ?? w : d(m, void 0, void 0, i) ? s?.disabledDateRangeMessage ?? o : null;
|
|
735
|
+
}
|
|
736
|
+
function T(e, a, n, i, s) {
|
|
737
|
+
const m = t(e), D = t(a);
|
|
738
|
+
if (isNaN(m.getTime()) || isNaN(D.getTime())) return !1;
|
|
739
|
+
const y = new Date(m);
|
|
740
|
+
y.setHours(0, 0, 0, 0);
|
|
741
|
+
const f = new Date(D);
|
|
742
|
+
for (f.setHours(0, 0, 0, 0); y <= f; ) {
|
|
743
|
+
if (d(r(y), i, s, n))
|
|
744
|
+
return !0;
|
|
745
|
+
y.setDate(y.getDate() + 1);
|
|
746
|
+
}
|
|
747
|
+
return !1;
|
|
748
|
+
}
|
|
749
|
+
function N(e) {
|
|
750
|
+
return new Intl.DateTimeFormat(e ?? "en", {
|
|
751
|
+
year: "numeric",
|
|
752
|
+
month: "numeric",
|
|
753
|
+
day: "numeric"
|
|
754
|
+
}).formatToParts(/* @__PURE__ */ new Date());
|
|
755
|
+
}
|
|
756
|
+
function p(e, a) {
|
|
757
|
+
return e === 2 ? new Date(a, 1, 29).getDate() === 29 || !a ? 29 : 28 : e === 4 || e === 6 || e === 9 || e === 11 ? 30 : 31;
|
|
758
|
+
}
|
|
759
|
+
function C(e) {
|
|
760
|
+
return u(e, /* @__PURE__ */ new Date());
|
|
723
761
|
}
|
|
724
|
-
function
|
|
762
|
+
function u(e, a) {
|
|
725
763
|
return e.getDate() === a.getDate() && e.getMonth() === a.getMonth() && e.getFullYear() === a.getFullYear();
|
|
726
764
|
}
|
|
727
|
-
function
|
|
765
|
+
function c(e) {
|
|
728
766
|
const a = [0, 1, 2, 3, 4, 5, 6], n = e % 7;
|
|
729
767
|
return [...a.slice(n), ...a.slice(0, n)];
|
|
730
768
|
}
|
|
731
|
-
function
|
|
732
|
-
const a =
|
|
733
|
-
return
|
|
769
|
+
function g(e) {
|
|
770
|
+
const a = e ?? "en", n = l[a] || l[a.split("-")[0]] || { firstDay: 0 };
|
|
771
|
+
return c(n.firstDay);
|
|
734
772
|
}
|
|
735
|
-
function
|
|
773
|
+
function v(e) {
|
|
736
774
|
const a = new Intl.DateTimeFormat(e, { weekday: "narrow" }), n = new Date(2025, 10, 30);
|
|
737
|
-
return
|
|
775
|
+
return g(e).map((i) => {
|
|
738
776
|
const s = new Date(n);
|
|
739
777
|
return s.setDate(n.getDate() + i), a.format(s);
|
|
740
778
|
});
|
|
741
779
|
}
|
|
742
|
-
function
|
|
780
|
+
function B(e, a, n) {
|
|
743
781
|
for (let i = 0; i < n; i++) {
|
|
744
782
|
const s = new Date(a.getFullYear(), a.getMonth() + i, 1);
|
|
745
783
|
if (e.getMonth() === s.getMonth() && e.getFullYear() === s.getFullYear())
|
|
@@ -747,18 +785,18 @@ function u(e, a, n) {
|
|
|
747
785
|
}
|
|
748
786
|
return !1;
|
|
749
787
|
}
|
|
750
|
-
function
|
|
788
|
+
function R(e, a, n = "long") {
|
|
751
789
|
return new Intl.DateTimeFormat(e, { month: n, year: "numeric" }).formatToParts(a).filter((s) => s.type === "month" || s.type === "year");
|
|
752
790
|
}
|
|
753
|
-
function
|
|
791
|
+
function H(e, a) {
|
|
754
792
|
const n = e || "en-US", m = new Intl.DateTimeFormat(n, { day: "numeric" }).formatToParts(a).find((D) => D.type === "day");
|
|
755
793
|
return m ? m.value : a.getDate().toString();
|
|
756
794
|
}
|
|
757
|
-
function
|
|
758
|
-
const n =
|
|
795
|
+
function A(e, a) {
|
|
796
|
+
const n = r(e), i = r(a);
|
|
759
797
|
return n === i ? { start: n } : { start: n, end: i };
|
|
760
798
|
}
|
|
761
|
-
function
|
|
799
|
+
function _(e) {
|
|
762
800
|
return e.length ? e.map((i) => ({
|
|
763
801
|
start: t(i.start).getTime(),
|
|
764
802
|
end: t(i.end ?? i.start).getTime()
|
|
@@ -773,18 +811,31 @@ function b(e) {
|
|
|
773
811
|
return [...i, s];
|
|
774
812
|
},
|
|
775
813
|
[]
|
|
776
|
-
).map((i) =>
|
|
814
|
+
).map((i) => A(new Date(i.start), new Date(i.end))) : [];
|
|
777
815
|
}
|
|
778
816
|
export {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
817
|
+
o as D,
|
|
818
|
+
I,
|
|
819
|
+
S as a,
|
|
820
|
+
h as b,
|
|
821
|
+
A as c,
|
|
822
|
+
G as d,
|
|
823
|
+
E as e,
|
|
824
|
+
C as f,
|
|
825
|
+
N as g,
|
|
826
|
+
H as h,
|
|
827
|
+
d as i,
|
|
828
|
+
B as j,
|
|
829
|
+
v as k,
|
|
830
|
+
R as l,
|
|
831
|
+
_ as m,
|
|
832
|
+
u as n,
|
|
833
|
+
b as o,
|
|
787
834
|
t as p,
|
|
788
|
-
|
|
789
|
-
|
|
835
|
+
L as q,
|
|
836
|
+
T as r,
|
|
837
|
+
p as s,
|
|
838
|
+
r as t,
|
|
839
|
+
M as u,
|
|
840
|
+
g as w
|
|
790
841
|
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { LitElement as u, nothing as p, html as h } from "lit";
|
|
2
|
+
import { property as s, customElement as c } from "lit/decorators.js";
|
|
3
|
+
import { classMap as g } from "lit/directives/class-map.js";
|
|
4
|
+
import { G as m, b as y, c as v } from "./templates-Dk1jxLwS.js";
|
|
5
|
+
import { n as b, G as D, r as f, q as E } from "./part-templates-Db871PS3.js";
|
|
6
|
+
import { g as C, d as w } from "./date-Bj9mI3GU.js";
|
|
7
|
+
var M = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (i, a, o, r) => {
|
|
8
|
+
for (var l = r > 1 ? void 0 : r ? P(a, o) : a, n = i.length - 1, d; n >= 0; n--)
|
|
9
|
+
(d = i[n]) && (l = (r ? d(a, o, l) : d(l)) || l);
|
|
10
|
+
return r && l && M(a, o, l), l;
|
|
11
|
+
};
|
|
12
|
+
let t = class extends u {
|
|
13
|
+
constructor() {
|
|
14
|
+
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 = void 0, this.invalidDateMessage = void 0, this.minDate = void 0, this.maxDate = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.inputBlockClass = "gui-date-input", this.groups = ["default"], this.partDescriptors = b(), this._parts = new D(this, {
|
|
15
|
+
blockClass: this.inputBlockClass,
|
|
16
|
+
groups: this.groups,
|
|
17
|
+
getDescriptor: (i) => this.getPartDescriptor(i),
|
|
18
|
+
commitGroup: (i) => this.validateAndEmit(i),
|
|
19
|
+
isReadonly: () => !!this.readOnly,
|
|
20
|
+
isDisabled: () => !!this.disabled,
|
|
21
|
+
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 }))
|
|
22
|
+
}), this.ariaController = new m(this, {
|
|
23
|
+
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
24
|
+
getState: () => ({
|
|
25
|
+
uid: this.uid,
|
|
26
|
+
templateData: {
|
|
27
|
+
hint: this.hint,
|
|
28
|
+
errors: this.errors,
|
|
29
|
+
readonly: this.readOnly,
|
|
30
|
+
disabled: this.disabled,
|
|
31
|
+
touched: this.touched
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
createRenderRoot() {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
41
|
+
}
|
|
42
|
+
getPartDescriptor(i) {
|
|
43
|
+
return this.partDescriptors[i];
|
|
44
|
+
}
|
|
45
|
+
willUpdate(i) {
|
|
46
|
+
i.has("value") && this._parts.setGroupFromISO("default", this.value ?? "", "date");
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const i = {
|
|
50
|
+
uid: this.uid,
|
|
51
|
+
label: this.label,
|
|
52
|
+
errors: this.errors,
|
|
53
|
+
touched: this.touched,
|
|
54
|
+
required: this.required,
|
|
55
|
+
disabled: this.disabled,
|
|
56
|
+
readonly: this.readOnly,
|
|
57
|
+
value: this.value,
|
|
58
|
+
icon: this.icon,
|
|
59
|
+
hint: this.hint
|
|
60
|
+
}, a = {
|
|
61
|
+
blockClass: this.inputBlockClass,
|
|
62
|
+
groups: this.groups,
|
|
63
|
+
formatParts: C(this.localeId),
|
|
64
|
+
getDescriptor: (r) => this.getPartDescriptor(r),
|
|
65
|
+
getDisplayValue: this._parts.getPartDisplay,
|
|
66
|
+
required: this.required,
|
|
67
|
+
disabled: this.disabled,
|
|
68
|
+
partsReadonly: !!this.readOnly
|
|
69
|
+
}, o = {
|
|
70
|
+
"gui-widget-icon": !0,
|
|
71
|
+
[this.icon]: !0
|
|
72
|
+
};
|
|
73
|
+
return h`
|
|
74
|
+
${this.label ? y(this.uid, i) : p}
|
|
75
|
+
|
|
76
|
+
<div class="gui-widget">
|
|
77
|
+
<div
|
|
78
|
+
class="gui-widget-input gui-parts gui-parts-ring gui-date-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
79
|
+
role="group"
|
|
80
|
+
>
|
|
81
|
+
${f("default", a, this._parts)}
|
|
82
|
+
</div>
|
|
83
|
+
${this.icon ? h`<span class=${g(o)} data-icon=${this.icon}></span>` : p}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
${this.showErrors && this.errors?.length ? v(this.uid, i) : p}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
validateAndEmit(i) {
|
|
90
|
+
const { result: a, writeBacks: o } = E(this._parts.values[i] ?? {}, {
|
|
91
|
+
descriptors: this.partDescriptors,
|
|
92
|
+
invalidDateMessage: this.invalidDateMessage
|
|
93
|
+
});
|
|
94
|
+
if (this._parts.applyWriteBacks(i, o), a.kind === "invalid")
|
|
95
|
+
this.dispatchEvent(
|
|
96
|
+
new CustomEvent("inputError", {
|
|
97
|
+
detail: { message: a.message },
|
|
98
|
+
bubbles: !0
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
else if (a.kind === "valid") {
|
|
102
|
+
const r = w(a.iso, this.minDate, this.maxDate, void 0, {
|
|
103
|
+
minDateMessage: this.minDateMessage,
|
|
104
|
+
maxDateMessage: this.maxDateMessage
|
|
105
|
+
});
|
|
106
|
+
if (r) {
|
|
107
|
+
this.dispatchEvent(
|
|
108
|
+
new CustomEvent("change", {
|
|
109
|
+
detail: { value: a.iso },
|
|
110
|
+
bubbles: !0
|
|
111
|
+
})
|
|
112
|
+
), this.dispatchEvent(
|
|
113
|
+
new CustomEvent("inputError", {
|
|
114
|
+
detail: { message: r },
|
|
115
|
+
bubbles: !0
|
|
116
|
+
})
|
|
117
|
+
), this.requestUpdate();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.value = a.iso, this.dispatchEvent(
|
|
121
|
+
new CustomEvent("change", {
|
|
122
|
+
detail: { value: this.value },
|
|
123
|
+
bubbles: !0
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
this.requestUpdate();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
e([
|
|
131
|
+
s({ type: String })
|
|
132
|
+
], t.prototype, "uid", 2);
|
|
133
|
+
e([
|
|
134
|
+
s({ type: String })
|
|
135
|
+
], t.prototype, "label", 2);
|
|
136
|
+
e([
|
|
137
|
+
s({ type: String, attribute: "locale-id" })
|
|
138
|
+
], t.prototype, "localeId", 2);
|
|
139
|
+
e([
|
|
140
|
+
s({ type: Array })
|
|
141
|
+
], t.prototype, "errors", 2);
|
|
142
|
+
e([
|
|
143
|
+
s({ type: Boolean })
|
|
144
|
+
], t.prototype, "showErrors", 2);
|
|
145
|
+
e([
|
|
146
|
+
s({ type: Boolean })
|
|
147
|
+
], t.prototype, "touched", 2);
|
|
148
|
+
e([
|
|
149
|
+
s({ type: Boolean })
|
|
150
|
+
], t.prototype, "required", 2);
|
|
151
|
+
e([
|
|
152
|
+
s({ type: Boolean })
|
|
153
|
+
], t.prototype, "disabled", 2);
|
|
154
|
+
e([
|
|
155
|
+
s({ type: Boolean, attribute: "readonly" })
|
|
156
|
+
], t.prototype, "readOnly", 2);
|
|
157
|
+
e([
|
|
158
|
+
s({ type: String })
|
|
159
|
+
], t.prototype, "icon", 2);
|
|
160
|
+
e([
|
|
161
|
+
s({ type: String })
|
|
162
|
+
], t.prototype, "hint", 2);
|
|
163
|
+
e([
|
|
164
|
+
s({ type: String })
|
|
165
|
+
], t.prototype, "value", 2);
|
|
166
|
+
e([
|
|
167
|
+
s({ type: String, attribute: "invalid-date-message" })
|
|
168
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
169
|
+
e([
|
|
170
|
+
s({ type: String, attribute: "min-date" })
|
|
171
|
+
], t.prototype, "minDate", 2);
|
|
172
|
+
e([
|
|
173
|
+
s({ type: String, attribute: "max-date" })
|
|
174
|
+
], t.prototype, "maxDate", 2);
|
|
175
|
+
e([
|
|
176
|
+
s({ type: String, attribute: "min-date-message" })
|
|
177
|
+
], t.prototype, "minDateMessage", 2);
|
|
178
|
+
e([
|
|
179
|
+
s({ type: String, attribute: "max-date-message" })
|
|
180
|
+
], t.prototype, "maxDateMessage", 2);
|
|
181
|
+
t = e([
|
|
182
|
+
c("gui-date")
|
|
183
|
+
], t);
|
|
184
|
+
typeof customElements < "u" && !customElements.get("gui-date") && customElements.define("gui-date", t);
|