@golemui/gui-react 0.12.2 → 0.13.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.
- package/Accordion-BU3skkjb.js +58 -0
- package/Alert-DpUiDxQT.js +17 -0
- package/Button-BYVR5EKG.js +86 -0
- package/CHANGELOG.md +16 -0
- package/{Calendar-Dxavv2c7.js → Calendar-BmMkpTcV.js} +13 -11
- package/Checkbox-B1Tsf-vi.js +164 -0
- package/Currency-D0pOQwU4.js +233 -0
- package/{DateInput-CdkyyAhc.js → DateInput-CqFHtc9F.js} +12 -10
- package/{DatePicker-TkMCndrw.js → DatePicker-BmW3TO0X.js} +18 -15
- package/{Dropdown-jKk4TyOa.js → Dropdown-C-_zDFCe.js} +5 -3
- package/Flex-Rs-RvIcq.js +20 -0
- package/{Grid-DREMTVQI.js → Grid-BcPUrfRL.js} +3 -2
- package/{List-BjMIo577.js → List-YkH8gdMh.js} +5 -3
- package/Markdown-DeAW4y3P.js +571 -0
- package/MarkdownText-BdISjAsE.js +11 -0
- package/Number-GsGZMR5a.js +247 -0
- package/Password-B8QjtpUe.js +204 -0
- package/RadioGroup-Cd1_Zkkz.js +197 -0
- package/{RangeCalendar-u2vxIhna.js → RangeCalendar-9IJoFEXw.js} +10 -8
- package/{RangeDateInput-CopLdb6J.js → RangeDateInput-DrVR4T_z.js} +21 -19
- package/{RangeDatePicker-DXpV-B_G.js → RangeDatePicker-Cq_Tt6NE.js} +38 -35
- package/{Renderer-B6WmwKDv.js → Renderer-CWqudTUu.js} +4 -2
- package/Repeater-DE-DAylQ.js +124 -0
- package/Select-CCCPYQW6.js +238 -0
- package/{Tabs-C2qqi8xO.js → Tabs-BVgVVvnu.js} +4 -3
- package/TextArea-BlRaVCon.js +202 -0
- package/TextInput-KuHLSN2X.js +169 -0
- package/Toggle-D-bglMPv.js +166 -0
- package/abstract-calendar-JfbbRwFb.js +528 -0
- package/calendar-BgptByan.js +95 -0
- package/class-map-DrTVAYz_.js +26 -0
- package/date-BS1lA1xg.js +786 -0
- package/date-input-Dux0mFJw.js +266 -0
- package/directive-1yd1wdny.js +555 -0
- package/errors-6UKoJh8Y.js +108 -0
- package/index.js +2705 -1171
- package/index.umd.cjs +878 -2
- package/lib/components/Accordion.d.ts +2 -2
- package/lib/components/Alert.d.ts +2 -2
- package/lib/components/Button.d.ts +2 -2
- package/lib/components/Calendar.d.ts +2 -2
- package/lib/components/Checkbox.d.ts +2 -2
- package/lib/components/Currency.d.ts +2 -2
- package/lib/components/DateInput.d.ts +2 -2
- package/lib/components/DatePicker.d.ts +2 -2
- package/lib/components/Dropdown.d.ts +2 -2
- package/lib/components/Flex.d.ts +2 -2
- package/lib/components/Form.d.ts +5 -5
- package/lib/components/Grid.d.ts +2 -2
- package/lib/components/List.d.ts +2 -2
- package/lib/components/Markdown.d.ts +2 -2
- package/lib/components/MarkdownText.d.ts +2 -2
- package/lib/components/Number.d.ts +2 -2
- package/lib/components/Password.d.ts +2 -2
- package/lib/components/RadioGroup.d.ts +2 -2
- package/lib/components/RangeCalendar.d.ts +2 -2
- package/lib/components/RangeDateInput.d.ts +2 -2
- package/lib/components/RangeDatePicker.d.ts +2 -2
- package/lib/components/Renderer.d.ts +2 -2
- package/lib/components/Repeater.d.ts +2 -2
- package/lib/components/Select.d.ts +2 -2
- package/lib/components/Tabs.d.ts +2 -2
- package/lib/components/TextArea.d.ts +2 -2
- package/lib/components/TextInput.d.ts +2 -2
- package/lib/components/Toggle.d.ts +2 -2
- package/lib/widget.loaders.d.ts +2 -2
- package/list-DHX7bG4r.js +282 -0
- package/live-BfTBpQrp.js +24 -0
- package/markdown-text-BUv0K0WF.js +44 -0
- package/one-of-DifUsEYY.js +48 -0
- package/package.json +6 -6
- package/query-h1h36oxg.js +12 -0
- package/range-calendar-SAyiW3EF.js +326 -0
- package/range-date-input-8WtB1urD.js +507 -0
- package/repeat-BucBfSPF.js +79 -0
- package/state-DI9ZsB5W.js +7 -0
- package/style-map-C_0XzJlx.js +29 -0
- package/tabs-DzSCq_98.js +13 -0
- package/templates-DBGyvZtc.js +75 -0
- package/Accordion-Btp_b0xA.js +0 -59
- package/Alert-CBgIsMKO.js +0 -16
- package/Button-DN0G-MUb.js +0 -21
- package/Checkbox-ViM9MktI.js +0 -30
- package/Currency-C4QFWO7Y.js +0 -37
- package/DefaultListItemRenderer-lNc9Kk7x.js +0 -18
- package/Flex-gD893rrB.js +0 -19
- package/Markdown-Ck_88HOR.js +0 -47
- package/MarkdownText-kJVkmihW.js +0 -9
- package/Number-CnQ95aLO.js +0 -35
- package/Password-Bg97DYW3.js +0 -36
- package/RadioGroup-Dldom5ja.js +0 -33
- package/Repeater-BYgXVfbl.js +0 -111
- package/Select-BLUX_W91.js +0 -55
- package/TextArea-cw3Q2v97.js +0 -35
- package/TextInput-geLoAA0c.js +0 -32
- package/Toggle-a7L71GwR.js +0 -30
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { i as w, A as g, b as p, n as h, t as D } from "./directive-1yd1wdny.js";
|
|
2
|
+
import { r as y } from "./state-DI9ZsB5W.js";
|
|
3
|
+
import { l as P } from "./live-BfTBpQrp.js";
|
|
4
|
+
import { c as v } from "./repeat-BucBfSPF.js";
|
|
5
|
+
import { e as m } from "./class-map-DrTVAYz_.js";
|
|
6
|
+
import { G as I, b as A, c as $ } from "./templates-DBGyvZtc.js";
|
|
7
|
+
import { t as f, m as O } from "./date-BS1lA1xg.js";
|
|
8
|
+
import { c as b } from "./tabs-DzSCq_98.js";
|
|
9
|
+
import "@golemui/gui-shared";
|
|
10
|
+
var L = Object.defineProperty, S = Object.getOwnPropertyDescriptor, o = (t, e, i, a) => {
|
|
11
|
+
for (var s = a > 1 ? void 0 : a ? S(e, i) : e, r = t.length - 1, d; r >= 0; r--)
|
|
12
|
+
(d = t[r]) && (s = (a ? d(e, i, s) : d(s)) || s);
|
|
13
|
+
return a && s && L(e, i, s), s;
|
|
14
|
+
};
|
|
15
|
+
let l = class extends w {
|
|
16
|
+
constructor() {
|
|
17
|
+
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.value = [], this.hint = void 0, this.icon = "", this.removePillAriaLabel = void 0, this.startDateAriaLabel = void 0, this.endDateAriaLabel = void 0, this.separator = void 0, this._startDate = { day: "", month: "", year: "" }, this._endDate = { day: "", month: "", year: "" }, this._isStartVisible = !0, this._isEndVisible = !0, this._showPillsList = !1, this.MIN_DAY = 1, this.MAX_DAY = 31, this.MAX_VALID_DAY = (t, e) => t === 2 ? new Date(e, 1, 29).getDate() === 29 || !e ? 29 : 28 : t === 4 || t === 6 || t === 9 || t === 11 ? 30 : 31, this.MIN_MONTH = 1, this.MAX_MONTH = 12, this.MIN_YEAR = 1e3, this.MAX_YEAR = 9999, this.ariaController = new I(this, {
|
|
18
|
+
getTargets: () => this.querySelectorAll(".gui-range-date-input"),
|
|
19
|
+
getState: () => ({
|
|
20
|
+
uid: this.uid,
|
|
21
|
+
templateData: {
|
|
22
|
+
hint: this.hint,
|
|
23
|
+
errors: this.errors,
|
|
24
|
+
readonly: this.readOnly,
|
|
25
|
+
disabled: this.disabled,
|
|
26
|
+
touched: this.touched
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}), this.handleOutsideInteraction = (t) => {
|
|
30
|
+
const e = this.querySelector(".gui-range-date-input__pills-compact"), i = this.querySelector(".gui-range-date-input__pills-dropdown"), a = t.composedPath()[0];
|
|
31
|
+
!e?.contains(a) && !i?.contains(a) && (this._showPillsList = !1, this.removeOutsideListeners());
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
createRenderRoot() {
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
super.connectedCallback(), this.classList.add("gui-field");
|
|
39
|
+
}
|
|
40
|
+
updated() {
|
|
41
|
+
this.setupObservers();
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback(), this.disconnectObservers(), this.removeOutsideListeners();
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
const t = {
|
|
48
|
+
uid: this.uid,
|
|
49
|
+
label: this.label,
|
|
50
|
+
errors: this.errors,
|
|
51
|
+
touched: this.touched,
|
|
52
|
+
required: this.required,
|
|
53
|
+
disabled: this.disabled,
|
|
54
|
+
readonly: this.readOnly,
|
|
55
|
+
value: this.value,
|
|
56
|
+
hint: this.hint
|
|
57
|
+
}, e = new Intl.DateTimeFormat(this.localeId ?? "en", {
|
|
58
|
+
year: "numeric",
|
|
59
|
+
month: "numeric",
|
|
60
|
+
day: "numeric"
|
|
61
|
+
}).formatToParts(/* @__PURE__ */ new Date()), i = this.getSortedPills(), a = {
|
|
62
|
+
"gui-widget-icon": !0,
|
|
63
|
+
[this.icon]: !!this.icon
|
|
64
|
+
};
|
|
65
|
+
return p`
|
|
66
|
+
${this.label ? A(this.uid, t, !1, void 0, !1) : g}
|
|
67
|
+
|
|
68
|
+
<div class="gui-widget">
|
|
69
|
+
<div
|
|
70
|
+
class="gui-range-date-input ${this.icon ? "gui-range-date-input--icon" : ""}"
|
|
71
|
+
role="group"
|
|
72
|
+
aria-label=${this.label ?? "Date range input"}
|
|
73
|
+
>
|
|
74
|
+
${this.icon ? p`<span class=${m(a)} data-icon=${this.icon}></span>` : g}
|
|
75
|
+
${i.length > 0 ? p`<div
|
|
76
|
+
class=${m({
|
|
77
|
+
"gui-range-date-input__pills-wrapper": !0,
|
|
78
|
+
"gui-range-date-input--start-shadow": !this._isStartVisible,
|
|
79
|
+
"gui-range-date-input--end-shadow": !this._isEndVisible
|
|
80
|
+
})}
|
|
81
|
+
>
|
|
82
|
+
<div class="gui-range-date-input__pills" role="list">
|
|
83
|
+
<span class="gui-sentinel gui-sentinel__start"></span>
|
|
84
|
+
${v(
|
|
85
|
+
i,
|
|
86
|
+
(s) => `${s.start}-${s.end ?? s.start}`,
|
|
87
|
+
(s, r) => this.renderPill(s, r)
|
|
88
|
+
)}
|
|
89
|
+
<span class="gui-sentinel gui-sentinel__end"></span>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="gui-range-date-input__pills-compact">
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
tabindex="0"
|
|
96
|
+
class="gui-range-date-input__pill--count"
|
|
97
|
+
aria-label="${i.length} date ranges"
|
|
98
|
+
@click=${this.togglePillsList}
|
|
99
|
+
>
|
|
100
|
+
${i.length}
|
|
101
|
+
</button>
|
|
102
|
+
</div>` : g}
|
|
103
|
+
|
|
104
|
+
<div class="gui-range-date-input__inputs">
|
|
105
|
+
<div
|
|
106
|
+
class="gui-range-date-input__field"
|
|
107
|
+
role="group"
|
|
108
|
+
aria-label=${this.startDateAriaLabel ?? "Start date"}
|
|
109
|
+
>
|
|
110
|
+
${this.renderDateInputs("start", e)}
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<span class="gui-range-date-input__separator">${this.separator ?? "-"}</span>
|
|
114
|
+
|
|
115
|
+
<div
|
|
116
|
+
class="gui-range-date-input__field"
|
|
117
|
+
role="group"
|
|
118
|
+
aria-label=${this.endDateAriaLabel ?? "End date"}
|
|
119
|
+
>
|
|
120
|
+
${this.renderDateInputs("end", e)}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
${this._showPillsList && i.length > 0 ? p`<div class="gui-range-date-input__pills-dropdown" role="list">
|
|
125
|
+
${v(
|
|
126
|
+
i,
|
|
127
|
+
(s) => `${s.start}-${s.end ?? s.start}`,
|
|
128
|
+
(s, r) => this.renderPill(s, r)
|
|
129
|
+
)}
|
|
130
|
+
</div>` : g}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
${this.showErrors && this.errors?.length ? $(this.uid, t) : g}
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
renderPill(t, e) {
|
|
137
|
+
const i = this.formatDateForDisplay(t.start), a = t.end ? this.formatDateForDisplay(t.end) : i, s = `${i} - ${a}`;
|
|
138
|
+
return p`
|
|
139
|
+
<div
|
|
140
|
+
class="gui-range-date-input__pill"
|
|
141
|
+
role="listitem"
|
|
142
|
+
tabindex="0"
|
|
143
|
+
aria-label="${this.removePillAriaLabel ?? "Remove date"} ${s}"
|
|
144
|
+
@click=${() => this.onPillClick(t)}
|
|
145
|
+
@focus=${this.handlePillFocus}
|
|
146
|
+
@keydown=${(r) => this.handlePillKeydown(r, e)}
|
|
147
|
+
>
|
|
148
|
+
<span class="gui-range-date-input__pill-text">${s}</span>
|
|
149
|
+
<button
|
|
150
|
+
type="button"
|
|
151
|
+
class="gui-range-date-input__pill-remove"
|
|
152
|
+
tabindex="-1"
|
|
153
|
+
?disabled=${this.disabled || this.readOnly}
|
|
154
|
+
@click=${() => this.removePill(e)}
|
|
155
|
+
>
|
|
156
|
+
<svg
|
|
157
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
158
|
+
width="16"
|
|
159
|
+
height="16"
|
|
160
|
+
viewBox="0 0 256 256"
|
|
161
|
+
fill="currentColor"
|
|
162
|
+
aria-hidden="true"
|
|
163
|
+
>
|
|
164
|
+
<path
|
|
165
|
+
d="M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"
|
|
166
|
+
></path>
|
|
167
|
+
</svg>
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
renderDateInputs(t, e) {
|
|
173
|
+
const i = t === "start" ? this._startDate : this._endDate;
|
|
174
|
+
return v(
|
|
175
|
+
e,
|
|
176
|
+
(a) => `${t}-${a.type}`,
|
|
177
|
+
(a, s) => {
|
|
178
|
+
const r = t === "start" && s === 0 ? 0 : -1;
|
|
179
|
+
switch (a.type) {
|
|
180
|
+
case "day":
|
|
181
|
+
return this.renderInput(t, "day", "dd", 2, r, i.day);
|
|
182
|
+
case "month":
|
|
183
|
+
return this.renderInput(t, "month", "mm", 2, r, i.month);
|
|
184
|
+
case "year":
|
|
185
|
+
return this.renderInput(t, "year", "yyyy", 4, r, i.year);
|
|
186
|
+
case "literal":
|
|
187
|
+
return p`<span class="gui-range-date-input__separator">${a.value}</span>`;
|
|
188
|
+
default:
|
|
189
|
+
return "";
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
renderInput(t, e, i, a, s, r) {
|
|
195
|
+
return p`
|
|
196
|
+
<div class="gui-range-date-input__touch-target">
|
|
197
|
+
<input
|
|
198
|
+
type="text"
|
|
199
|
+
inputmode="numeric"
|
|
200
|
+
class="gui-range-date-input__part ${e === "year" ? "gui-range-date-input__year" : ""}"
|
|
201
|
+
data-type=${e}
|
|
202
|
+
data-group=${t}
|
|
203
|
+
maxlength=${a}
|
|
204
|
+
placeholder=${i}
|
|
205
|
+
tabindex=${s}
|
|
206
|
+
?required=${this.required}
|
|
207
|
+
?disabled=${this.disabled}
|
|
208
|
+
?readonly=${this.readOnly}
|
|
209
|
+
autocomplete="off"
|
|
210
|
+
.value=${P(r)}
|
|
211
|
+
@keydown=${this.handleKeyDown}
|
|
212
|
+
@keyup=${(d) => this.handleKeyUp(d, t, e)}
|
|
213
|
+
@focus=${this.handleFocus}
|
|
214
|
+
@blur=${(d) => this.handleBlur(d, t, e)}
|
|
215
|
+
@change=${(d) => this.handleChange(d, t, e)}
|
|
216
|
+
/>
|
|
217
|
+
<div class="gui-range-date-input__visual-underline"></div>
|
|
218
|
+
</div>
|
|
219
|
+
`;
|
|
220
|
+
}
|
|
221
|
+
formatDateForDisplay(t) {
|
|
222
|
+
const e = new Date(t);
|
|
223
|
+
return isNaN(e.getTime()) ? t : new Intl.DateTimeFormat(this.localeId ?? "en", {
|
|
224
|
+
year: "numeric",
|
|
225
|
+
month: "2-digit",
|
|
226
|
+
day: "2-digit"
|
|
227
|
+
}).format(e);
|
|
228
|
+
}
|
|
229
|
+
getSortedPills() {
|
|
230
|
+
return !this.value || !Array.isArray(this.value) ? [] : [...this.value].sort(
|
|
231
|
+
(t, e) => new Date(t.start).getTime() - new Date(e.start).getTime()
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
togglePillsList() {
|
|
235
|
+
this._showPillsList = !this._showPillsList, this._showPillsList ? requestAnimationFrame(() => {
|
|
236
|
+
document.addEventListener("pointerdown", this.handleOutsideInteraction), document.addEventListener("focusin", this.handleOutsideInteraction), this.querySelector(
|
|
237
|
+
".gui-range-date-input__pills-dropdown .gui-range-date-input__pill"
|
|
238
|
+
)?.focus();
|
|
239
|
+
}) : this.removeOutsideListeners();
|
|
240
|
+
}
|
|
241
|
+
removeOutsideListeners() {
|
|
242
|
+
document.removeEventListener("pointerdown", this.handleOutsideInteraction), document.removeEventListener("focusin", this.handleOutsideInteraction);
|
|
243
|
+
}
|
|
244
|
+
removePill(t) {
|
|
245
|
+
if (this.disabled || this.readOnly) return;
|
|
246
|
+
const e = this.getSortedPills();
|
|
247
|
+
e.splice(t, 1), this.value = [...e], this.dispatchEvent(
|
|
248
|
+
new CustomEvent("change", {
|
|
249
|
+
detail: { value: this.value },
|
|
250
|
+
bubbles: !0,
|
|
251
|
+
composed: !0
|
|
252
|
+
})
|
|
253
|
+
), this._showPillsList && e.length === 0 && (this._showPillsList = !1, this.removeOutsideListeners()), requestAnimationFrame(() => {
|
|
254
|
+
const i = this._showPillsList ? ".gui-range-date-input__pills-dropdown .gui-range-date-input__pill" : ".gui-range-date-input__pills .gui-range-date-input__pill", a = this.querySelectorAll(i);
|
|
255
|
+
if (a.length > 0) {
|
|
256
|
+
const s = Math.min(t, a.length - 1);
|
|
257
|
+
a[s].focus();
|
|
258
|
+
} else
|
|
259
|
+
this.querySelector(
|
|
260
|
+
".gui-range-date-input__field input"
|
|
261
|
+
)?.focus();
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
handlePillFocus(t) {
|
|
265
|
+
t.target.scrollIntoView({
|
|
266
|
+
behavior: "smooth",
|
|
267
|
+
block: "nearest",
|
|
268
|
+
inline: "nearest"
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
handlePillKeydown(t, e) {
|
|
272
|
+
if (t.key === "Delete" || t.key === "Backspace") {
|
|
273
|
+
t.preventDefault(), t.stopPropagation(), this.removePill(e);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
277
|
+
t.preventDefault();
|
|
278
|
+
const r = this.getSortedPills();
|
|
279
|
+
r[e] && this.onPillClick(r[e]);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const i = this._showPillsList, a = i ? "ArrowUp" : "ArrowLeft", s = i ? "ArrowDown" : "ArrowRight";
|
|
283
|
+
if (t.key === a || t.key === s) {
|
|
284
|
+
t.preventDefault();
|
|
285
|
+
const r = i ? ".gui-range-date-input__pills-dropdown .gui-range-date-input__pill" : ".gui-range-date-input__pills .gui-range-date-input__pill", d = this.querySelectorAll(r), n = t.key === a ? e - 1 : e + 1;
|
|
286
|
+
n >= 0 && n < d.length && d[n].focus();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
onPillClick(t) {
|
|
290
|
+
this.dispatchEvent(
|
|
291
|
+
new CustomEvent("pillClick", {
|
|
292
|
+
detail: { range: t },
|
|
293
|
+
bubbles: !0,
|
|
294
|
+
composed: !0
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
handleKeyDown(t) {
|
|
299
|
+
[
|
|
300
|
+
"Backspace",
|
|
301
|
+
"Tab",
|
|
302
|
+
"ArrowUp",
|
|
303
|
+
"ArrowDown",
|
|
304
|
+
"ArrowLeft",
|
|
305
|
+
"ArrowRight",
|
|
306
|
+
"Delete",
|
|
307
|
+
"Enter"
|
|
308
|
+
].includes(t.key) || t.ctrlKey || t.metaKey || this.readOnly || /^[0-9]$/.test(t.key) || t.preventDefault();
|
|
309
|
+
}
|
|
310
|
+
handleFocus(t) {
|
|
311
|
+
this.dispatchEvent(new CustomEvent("focus", { detail: t }));
|
|
312
|
+
}
|
|
313
|
+
handleKeyUp(t, e, i) {
|
|
314
|
+
if (this.readOnly) return;
|
|
315
|
+
const a = window.getComputedStyle(this).direction === "rtl", s = t.target, r = this.getGroupInputs(e), d = r.indexOf(s);
|
|
316
|
+
if (s.value.length === s.maxLength && /^[0-9]$/.test(t.key))
|
|
317
|
+
if (d === r.length - 1) {
|
|
318
|
+
if (e === "start") {
|
|
319
|
+
const n = this.getGroupInputs("end");
|
|
320
|
+
n.length > 0 && n[0].focus();
|
|
321
|
+
}
|
|
322
|
+
} else
|
|
323
|
+
r[d + 1].focus();
|
|
324
|
+
switch (t.key) {
|
|
325
|
+
case "Enter": {
|
|
326
|
+
if (this.tryCreatePill(), this.value && this.value.length > 0) {
|
|
327
|
+
const n = this.value[this.value.length - 1];
|
|
328
|
+
this.onPillClick(n);
|
|
329
|
+
}
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
case "ArrowUp": {
|
|
333
|
+
const n = isNaN(parseInt(s.value, 10) + 1) ? 1 : parseInt(s.value, 10) + 1;
|
|
334
|
+
this.setDatePartValue(e, i, n), s.select(), this.tryCreatePill();
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case "ArrowDown": {
|
|
338
|
+
const n = isNaN(parseInt(s.value, 10) - 1) ? 1 : parseInt(s.value, 10) - 1;
|
|
339
|
+
this.setDatePartValue(e, i, n), s.select(), this.tryCreatePill();
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
case "ArrowLeft": {
|
|
343
|
+
const n = a ? d + 1 : d - 1;
|
|
344
|
+
if (n >= 0 && n < r.length)
|
|
345
|
+
r[n].focus(), r[n].select();
|
|
346
|
+
else {
|
|
347
|
+
const u = a ? "end" : "start";
|
|
348
|
+
if (e !== u) {
|
|
349
|
+
const c = this.getGroupInputs(u);
|
|
350
|
+
if (c.length > 0) {
|
|
351
|
+
const _ = c[c.length - 1];
|
|
352
|
+
_.focus(), _.select();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
case "ArrowRight": {
|
|
359
|
+
const n = a ? d - 1 : d + 1;
|
|
360
|
+
if (n >= 0 && n < r.length)
|
|
361
|
+
r[n].focus(), r[n].select();
|
|
362
|
+
else {
|
|
363
|
+
const u = a ? "start" : "end";
|
|
364
|
+
if (e !== u) {
|
|
365
|
+
const c = this.getGroupInputs(u);
|
|
366
|
+
c.length > 0 && (c[0].focus(), c[0].select());
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
handleChange(t, e, i) {
|
|
374
|
+
if (t.stopImmediatePropagation(), this.readOnly) return;
|
|
375
|
+
const s = t.target.value.replace(/[^0-9]/g, "");
|
|
376
|
+
this.updateDatePart(e, i, s), this.tryCreatePill();
|
|
377
|
+
}
|
|
378
|
+
handleBlur(t, e, i) {
|
|
379
|
+
const a = t.target, s = parseInt(a.value, 10);
|
|
380
|
+
if (!isNaN(s) && s > 0) {
|
|
381
|
+
const r = i === "year" ? 4 : 2;
|
|
382
|
+
a.value = s.toString().padStart(r, "0");
|
|
383
|
+
}
|
|
384
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
385
|
+
}
|
|
386
|
+
getGroupInputs(t) {
|
|
387
|
+
return Array.from(this.querySelectorAll(`input[data-group="${t}"]`));
|
|
388
|
+
}
|
|
389
|
+
setDatePartValue(t, e, i) {
|
|
390
|
+
const a = t === "start" ? this._startDate : this._endDate, s = e === "year" ? 4 : 2;
|
|
391
|
+
e === "day" && (a.day = i.toString().padStart(s, "0")), e === "month" && (a.month = i.toString().padStart(s, "0")), e === "year" && (a.year = i.toString().padStart(s, "0")), t === "start" ? this._startDate = { ...a } : this._endDate = { ...a };
|
|
392
|
+
}
|
|
393
|
+
updateDatePart(t, e, i) {
|
|
394
|
+
t === "start" ? this._startDate = { ...this._startDate, [e]: i } : this._endDate = { ...this._endDate, [e]: i };
|
|
395
|
+
}
|
|
396
|
+
validateDateParts(t) {
|
|
397
|
+
let e = parseInt(t.year, 10), i = parseInt(t.month, 10), a = parseInt(t.day, 10);
|
|
398
|
+
if (isNaN(e) || isNaN(i) || isNaN(a) || String(e).length < 4) return null;
|
|
399
|
+
e = Math.max(this.MIN_YEAR, Math.min(this.MAX_YEAR, e)), i = Math.max(this.MIN_MONTH, Math.min(this.MAX_MONTH, i)), a = Math.max(this.MIN_DAY, Math.min(this.MAX_DAY, a));
|
|
400
|
+
const s = this.MAX_VALID_DAY(i, e);
|
|
401
|
+
return a > s ? (this.dispatchEvent(
|
|
402
|
+
new CustomEvent("inputError", {
|
|
403
|
+
detail: {
|
|
404
|
+
message: "Invalid date: day is greater than the maximum valid day for the month and year."
|
|
405
|
+
},
|
|
406
|
+
bubbles: !0
|
|
407
|
+
})
|
|
408
|
+
), null) : new Date(e, i - 1, a);
|
|
409
|
+
}
|
|
410
|
+
setupObservers() {
|
|
411
|
+
const t = this.querySelector(".gui-sentinel__start"), e = this.querySelector(".gui-sentinel__end");
|
|
412
|
+
t && !this.startObserver && (this.startObserver = b(
|
|
413
|
+
t,
|
|
414
|
+
(i) => this._isStartVisible = i
|
|
415
|
+
)), e && !this.endObserver && (this.endObserver = b(
|
|
416
|
+
e,
|
|
417
|
+
(i) => this._isEndVisible = i
|
|
418
|
+
)), !t && this.startObserver && (this.startObserver.disconnect(), this.startObserver = void 0, this._isStartVisible = !0), !e && this.endObserver && (this.endObserver.disconnect(), this.endObserver = void 0, this._isEndVisible = !0);
|
|
419
|
+
}
|
|
420
|
+
disconnectObservers() {
|
|
421
|
+
this.startObserver?.disconnect(), this.endObserver?.disconnect(), this.startObserver = void 0, this.endObserver = void 0;
|
|
422
|
+
}
|
|
423
|
+
tryCreatePill() {
|
|
424
|
+
const t = this.validateDateParts(this._startDate), e = this.validateDateParts(this._endDate);
|
|
425
|
+
if (!t || !e) return;
|
|
426
|
+
let i = t, a = e;
|
|
427
|
+
e.getTime() < t.getTime() && (i = e, a = t);
|
|
428
|
+
const s = f(i), r = f(a), d = s === r ? { start: s } : { start: s, end: r }, n = this.value ? [...this.value] : [];
|
|
429
|
+
n.push(d), this.value = O(n), this._startDate = { day: "", month: "", year: "" }, this._endDate = { day: "", month: "", year: "" }, this.dispatchEvent(
|
|
430
|
+
new CustomEvent("change", {
|
|
431
|
+
detail: { value: this.value },
|
|
432
|
+
bubbles: !0,
|
|
433
|
+
composed: !0
|
|
434
|
+
})
|
|
435
|
+
), requestAnimationFrame(() => {
|
|
436
|
+
const u = this.getGroupInputs("start");
|
|
437
|
+
u.length > 0 && u[0].focus();
|
|
438
|
+
}), this.requestUpdate();
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
o([
|
|
442
|
+
h({ type: String })
|
|
443
|
+
], l.prototype, "uid", 2);
|
|
444
|
+
o([
|
|
445
|
+
h({ type: String })
|
|
446
|
+
], l.prototype, "label", 2);
|
|
447
|
+
o([
|
|
448
|
+
h({ type: String, attribute: "locale-id" })
|
|
449
|
+
], l.prototype, "localeId", 2);
|
|
450
|
+
o([
|
|
451
|
+
h({ type: Array })
|
|
452
|
+
], l.prototype, "errors", 2);
|
|
453
|
+
o([
|
|
454
|
+
h({ type: Boolean })
|
|
455
|
+
], l.prototype, "showErrors", 2);
|
|
456
|
+
o([
|
|
457
|
+
h({ type: Boolean })
|
|
458
|
+
], l.prototype, "touched", 2);
|
|
459
|
+
o([
|
|
460
|
+
h({ type: Boolean })
|
|
461
|
+
], l.prototype, "required", 2);
|
|
462
|
+
o([
|
|
463
|
+
h({ type: Boolean })
|
|
464
|
+
], l.prototype, "disabled", 2);
|
|
465
|
+
o([
|
|
466
|
+
h({ type: Boolean, attribute: "readonly" })
|
|
467
|
+
], l.prototype, "readOnly", 2);
|
|
468
|
+
o([
|
|
469
|
+
h({ type: Array })
|
|
470
|
+
], l.prototype, "value", 2);
|
|
471
|
+
o([
|
|
472
|
+
h({ type: String })
|
|
473
|
+
], l.prototype, "hint", 2);
|
|
474
|
+
o([
|
|
475
|
+
h({ type: String })
|
|
476
|
+
], l.prototype, "icon", 2);
|
|
477
|
+
o([
|
|
478
|
+
h({ type: String })
|
|
479
|
+
], l.prototype, "removePillAriaLabel", 2);
|
|
480
|
+
o([
|
|
481
|
+
h({ type: String })
|
|
482
|
+
], l.prototype, "startDateAriaLabel", 2);
|
|
483
|
+
o([
|
|
484
|
+
h({ type: String })
|
|
485
|
+
], l.prototype, "endDateAriaLabel", 2);
|
|
486
|
+
o([
|
|
487
|
+
h({ type: String })
|
|
488
|
+
], l.prototype, "separator", 2);
|
|
489
|
+
o([
|
|
490
|
+
y()
|
|
491
|
+
], l.prototype, "_startDate", 2);
|
|
492
|
+
o([
|
|
493
|
+
y()
|
|
494
|
+
], l.prototype, "_endDate", 2);
|
|
495
|
+
o([
|
|
496
|
+
y()
|
|
497
|
+
], l.prototype, "_isStartVisible", 2);
|
|
498
|
+
o([
|
|
499
|
+
y()
|
|
500
|
+
], l.prototype, "_isEndVisible", 2);
|
|
501
|
+
o([
|
|
502
|
+
y()
|
|
503
|
+
], l.prototype, "_showPillsList", 2);
|
|
504
|
+
l = o([
|
|
505
|
+
D("gui-range-date")
|
|
506
|
+
], l);
|
|
507
|
+
typeof customElements < "u" && !customElements.get("gui-range-date") && customElements.define("gui-range-date", l);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { j as w, e as M, a as b, c as k, E as H } from "./directive-1yd1wdny.js";
|
|
2
|
+
const { I } = w, y = (e) => e, S = (e) => e.strings === void 0, g = () => document.createComment(""), v = (e, f, n) => {
|
|
3
|
+
const $ = e._$AA.parentNode, t = f === void 0 ? e._$AB : f._$AA;
|
|
4
|
+
if (n === void 0) {
|
|
5
|
+
const o = $.insertBefore(g(), t), s = $.insertBefore(g(), t);
|
|
6
|
+
n = new I(o, s, e, e.options);
|
|
7
|
+
} else {
|
|
8
|
+
const o = n._$AB.nextSibling, s = n._$AM, c = s !== e;
|
|
9
|
+
if (c) {
|
|
10
|
+
let l;
|
|
11
|
+
n._$AQ?.(e), n._$AM = e, n._$AP !== void 0 && (l = e._$AU) !== s._$AU && n._$AP(l);
|
|
12
|
+
}
|
|
13
|
+
if (o !== t || c) {
|
|
14
|
+
let l = n._$AA;
|
|
15
|
+
for (; l !== o; ) {
|
|
16
|
+
const _ = y(l).nextSibling;
|
|
17
|
+
y($).insertBefore(l, t), l = _;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return n;
|
|
22
|
+
}, a = (e, f, n = e) => (e._$AI(f, n), e), j = {}, C = (e, f = j) => e._$AH = f, E = (e) => e._$AH, p = (e) => {
|
|
23
|
+
e._$AR(), e._$AA.remove();
|
|
24
|
+
};
|
|
25
|
+
const B = (e, f, n) => {
|
|
26
|
+
const $ = /* @__PURE__ */ new Map();
|
|
27
|
+
for (let t = f; t <= n; t++) $.set(e[t], t);
|
|
28
|
+
return $;
|
|
29
|
+
}, U = M(class extends b {
|
|
30
|
+
constructor(e) {
|
|
31
|
+
if (super(e), e.type !== k.CHILD) throw Error("repeat() can only be used in text expressions");
|
|
32
|
+
}
|
|
33
|
+
dt(e, f, n) {
|
|
34
|
+
let $;
|
|
35
|
+
n === void 0 ? n = f : f !== void 0 && ($ = f);
|
|
36
|
+
const t = [], o = [];
|
|
37
|
+
let s = 0;
|
|
38
|
+
for (const c of e) t[s] = $ ? $(c, s) : s, o[s] = n(c, s), s++;
|
|
39
|
+
return { values: o, keys: t };
|
|
40
|
+
}
|
|
41
|
+
render(e, f, n) {
|
|
42
|
+
return this.dt(e, f, n).values;
|
|
43
|
+
}
|
|
44
|
+
update(e, [f, n, $]) {
|
|
45
|
+
const t = E(e), { values: o, keys: s } = this.dt(f, n, $);
|
|
46
|
+
if (!Array.isArray(t)) return this.ut = s, o;
|
|
47
|
+
const c = this.ut ??= [], l = [];
|
|
48
|
+
let _, m, r = 0, u = t.length - 1, i = 0, A = o.length - 1;
|
|
49
|
+
for (; r <= u && i <= A; ) if (t[r] === null) r++;
|
|
50
|
+
else if (t[u] === null) u--;
|
|
51
|
+
else if (c[r] === s[i]) l[i] = a(t[r], o[i]), r++, i++;
|
|
52
|
+
else if (c[u] === s[A]) l[A] = a(t[u], o[A]), u--, A--;
|
|
53
|
+
else if (c[r] === s[A]) l[A] = a(t[r], o[A]), v(e, l[A + 1], t[r]), r++, A--;
|
|
54
|
+
else if (c[u] === s[i]) l[i] = a(t[u], o[i]), v(e, t[r], t[u]), u--, i++;
|
|
55
|
+
else if (_ === void 0 && (_ = B(s, i, A), m = B(c, r, u)), _.has(c[r])) if (_.has(c[u])) {
|
|
56
|
+
const d = m.get(s[i]), h = d !== void 0 ? t[d] : null;
|
|
57
|
+
if (h === null) {
|
|
58
|
+
const x = v(e, t[r]);
|
|
59
|
+
a(x, o[i]), l[i] = x;
|
|
60
|
+
} else l[i] = a(h, o[i]), v(e, t[r], h), t[d] = null;
|
|
61
|
+
i++;
|
|
62
|
+
} else p(t[u]), u--;
|
|
63
|
+
else p(t[r]), r++;
|
|
64
|
+
for (; i <= A; ) {
|
|
65
|
+
const d = v(e, l[A + 1]);
|
|
66
|
+
a(d, o[i]), l[i++] = d;
|
|
67
|
+
}
|
|
68
|
+
for (; r <= u; ) {
|
|
69
|
+
const d = t[r++];
|
|
70
|
+
d !== null && p(d);
|
|
71
|
+
}
|
|
72
|
+
return this.ut = s, C(e, l), H;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
U as c,
|
|
77
|
+
C as p,
|
|
78
|
+
S as r
|
|
79
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { e as l, a as c, c as u, E as d } from "./directive-1yd1wdny.js";
|
|
2
|
+
const o = "important", a = " !" + o, h = l(class extends c {
|
|
3
|
+
constructor(s) {
|
|
4
|
+
if (super(s), s.type !== u.ATTRIBUTE || s.name !== "style" || s.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
5
|
+
}
|
|
6
|
+
render(s) {
|
|
7
|
+
return Object.keys(s).reduce((n, e) => {
|
|
8
|
+
const t = s[e];
|
|
9
|
+
return t == null ? n : n + `${e = e.includes("-") ? e : e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${t};`;
|
|
10
|
+
}, "");
|
|
11
|
+
}
|
|
12
|
+
update(s, [n]) {
|
|
13
|
+
const { style: e } = s.element;
|
|
14
|
+
if (this.ft === void 0) return this.ft = new Set(Object.keys(n)), this.render(n);
|
|
15
|
+
for (const t of this.ft) n[t] == null && (this.ft.delete(t), t.includes("-") ? e.removeProperty(t) : e[t] = null);
|
|
16
|
+
for (const t in n) {
|
|
17
|
+
const r = n[t];
|
|
18
|
+
if (r != null) {
|
|
19
|
+
this.ft.add(t);
|
|
20
|
+
const i = typeof r == "string" && r.endsWith(a);
|
|
21
|
+
t.includes("-") || i ? e.setProperty(t, i ? r.slice(0, -11) : r, i ? o : "") : e[t] = r;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return d;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
h as o
|
|
29
|
+
};
|
package/tabs-DzSCq_98.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function c(e, t, n) {
|
|
2
|
+
if (!e)
|
|
3
|
+
throw new TypeError("The element provided to the IntersectionObserver must exist");
|
|
4
|
+
const r = new IntersectionObserver((s) => {
|
|
5
|
+
s.forEach((o) => {
|
|
6
|
+
t(o.isIntersecting);
|
|
7
|
+
});
|
|
8
|
+
}, n);
|
|
9
|
+
return r.observe(e), r;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
c
|
|
13
|
+
};
|