@golemui/gui-lit 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -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
package/templates-Df7abEkB.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { filterTap as C } from "@golemui/core";
|
|
2
|
-
import { html as a, nothing as i } from "lit";
|
|
3
|
-
import { classMap as _ } from "lit/directives/class-map.js";
|
|
4
|
-
class T {
|
|
5
|
-
constructor(r, e) {
|
|
6
|
-
r.addController(this), this.getTargets = e.getTargets, this.getState = e.getState;
|
|
7
|
-
}
|
|
8
|
-
hostConnected() {
|
|
9
|
-
}
|
|
10
|
-
hostUpdated() {
|
|
11
|
-
const r = this.getTargets();
|
|
12
|
-
if (!r) return;
|
|
13
|
-
let e = [];
|
|
14
|
-
r instanceof NodeList ? e = Array.from(r) : Array.isArray(r) ? e = r : e = [r];
|
|
15
|
-
const { uid: l, templateData: n } = this.getState(), { touched: f, errors: c, readonly: v, disabled: A, hint: y, required: q } = n, d = f && c && c.length > 0;
|
|
16
|
-
C(
|
|
17
|
-
e,
|
|
18
|
-
(t) => !!t,
|
|
19
|
-
(t) => {
|
|
20
|
-
const o = ($, u) => {
|
|
21
|
-
u ? t.setAttribute($, u) : t.removeAttribute($);
|
|
22
|
-
};
|
|
23
|
-
o("aria-describedby", y ? `${l}_hint` : null), o("aria-invalid", d ? "true" : null), o("aria-errormessage", d ? `${l}_errors` : null), o("aria-readonly", v ? "true" : null), o("aria-disabled", A ? "true" : null), o("aria-required", q ? "true" : null);
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const g = (s) => s ? a`<span aria-hidden="true"> *</span>` : i, E = (s, r, e = !1, l = void 0, n = !0) => n ? r.label ? a`<label
|
|
29
|
-
class="gui-label"
|
|
30
|
-
for=${s}
|
|
31
|
-
data-cy=${`${s}_label`}
|
|
32
|
-
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
33
|
-
>
|
|
34
|
-
<span class="gui-label__text"
|
|
35
|
-
>${r.label}${g(r.required)}</span
|
|
36
|
-
>
|
|
37
|
-
${h(s, r)} ${e ? b(s, r) : i}
|
|
38
|
-
</label>` : i : r.label ? a`<span
|
|
39
|
-
class="gui-label"
|
|
40
|
-
data-cy=${`${s}_label`}
|
|
41
|
-
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
42
|
-
>
|
|
43
|
-
<span class="gui-label__text"
|
|
44
|
-
>${r.label}${g(r.required)}</span
|
|
45
|
-
>
|
|
46
|
-
${h(s, r)} ${e ? b(s, r) : i}
|
|
47
|
-
</span>` : i, h = (s, r) => r.hint ? a`<div class="gui-widget-hint" id=${`${s}_hint`}>${r.hint}</div>` : a``, G = (s, r) => {
|
|
48
|
-
const e = {
|
|
49
|
-
[`gui-${s}--icon`]: !1,
|
|
50
|
-
[`gui-${s}--icon-right`]: !1
|
|
51
|
-
};
|
|
52
|
-
if (r.icon) {
|
|
53
|
-
e[`gui-${s}--icon`] = !0;
|
|
54
|
-
const l = {
|
|
55
|
-
"gui-widget-icon": !0,
|
|
56
|
-
[r.icon]: !0
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
widgetClasses: e,
|
|
60
|
-
html: a`<span
|
|
61
|
-
class=${_(l)}
|
|
62
|
-
data-icon=${r.icon}
|
|
63
|
-
aria-hidden="true"
|
|
64
|
-
></span>`
|
|
65
|
-
};
|
|
66
|
-
} else
|
|
67
|
-
return { widgetClasses: e, html: a`` };
|
|
68
|
-
}, b = (s, r) => {
|
|
69
|
-
const e = r.touched && r.errors && r.errors.length > 0;
|
|
70
|
-
return a`<ul
|
|
71
|
-
class=${_({
|
|
72
|
-
"gui-validator": !0,
|
|
73
|
-
"gui-validator--empty": !e
|
|
74
|
-
})}
|
|
75
|
-
id=${`${s}_errors`}
|
|
76
|
-
role="alert"
|
|
77
|
-
data-cy=${e ? `${s}_validator-errors` : i}
|
|
78
|
-
>
|
|
79
|
-
${e ? r.errors?.map(
|
|
80
|
-
(n) => a`<li class="gui-validator__error" data-cy=${`${s}_validator-error`}>
|
|
81
|
-
${n}
|
|
82
|
-
</li>`
|
|
83
|
-
) : i}
|
|
84
|
-
</ul>`;
|
|
85
|
-
};
|
|
86
|
-
export {
|
|
87
|
-
T as G,
|
|
88
|
-
G as a,
|
|
89
|
-
E as b,
|
|
90
|
-
b as c,
|
|
91
|
-
g as r
|
|
92
|
-
};
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { InputWidgetAdapter as v, formContext as b, inputContext as $ } from "@golemui/lit";
|
|
2
|
-
import { LitElement as m, html as n, nothing as c } from "lit";
|
|
3
|
-
import { property as i, customElement as g } from "lit/decorators.js";
|
|
4
|
-
import { classMap as x } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as f, b as C, c as w } from "./templates-Df7abEkB.js";
|
|
6
|
-
import { styleMap as D } from "lit-html/directives/style-map.js";
|
|
7
|
-
import { consume as _, provide as L } from "@lit/context";
|
|
8
|
-
import "rxjs";
|
|
9
|
-
var S = Object.defineProperty, q = Object.getOwnPropertyDescriptor, o = (t, a, d, s) => {
|
|
10
|
-
for (var e = s > 1 ? void 0 : s ? q(a, d) : a, l = t.length - 1, p; l >= 0; l--)
|
|
11
|
-
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
12
|
-
return s && e && S(a, d, e), e;
|
|
13
|
-
};
|
|
14
|
-
let r = class extends m {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimumHeight = void 0, this.autoGrow = !1, this.maxLength = void 0, this.ariaController = new f(this, {
|
|
17
|
-
getTargets: () => this.querySelectorAll(`textarea[id="${this.uid}"]`),
|
|
18
|
-
getState: () => ({
|
|
19
|
-
uid: this.uid,
|
|
20
|
-
templateData: {
|
|
21
|
-
hint: this.hint,
|
|
22
|
-
errors: this.errors,
|
|
23
|
-
readonly: this.readOnly,
|
|
24
|
-
disabled: this.disabled,
|
|
25
|
-
touched: this.touched,
|
|
26
|
-
required: this.required
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
createRenderRoot() {
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
connectedCallback() {
|
|
35
|
-
super.connectedCallback(), this.classList.add("gui-field");
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
super.render();
|
|
39
|
-
const t = {
|
|
40
|
-
uid: this.uid,
|
|
41
|
-
label: this.label,
|
|
42
|
-
errors: this.errors,
|
|
43
|
-
touched: this.touched,
|
|
44
|
-
required: this.required,
|
|
45
|
-
disabled: this.disabled,
|
|
46
|
-
readonly: this.readOnly,
|
|
47
|
-
value: this.value,
|
|
48
|
-
hint: this.hint,
|
|
49
|
-
placeholder: this.placeholder,
|
|
50
|
-
autocomplete: this.autocomplete,
|
|
51
|
-
counterMode: this.counterMode ?? "remaining",
|
|
52
|
-
minimumHeight: this.minimumHeight ?? 120,
|
|
53
|
-
autoGrow: this.autoGrow ?? !1,
|
|
54
|
-
maxLength: this.maxLength
|
|
55
|
-
};
|
|
56
|
-
let a = n``;
|
|
57
|
-
if (t.counterMode && t.maxLength) {
|
|
58
|
-
const e = {
|
|
59
|
-
"gui-textarea--counter": !0,
|
|
60
|
-
"gui-textarea--counter__error": (t.value?.length ?? 0) > t.maxLength
|
|
61
|
-
}, l = t.counterMode === "current" ? n`<span>${t.value?.length ?? 0}</span>` : n`<span>${t.maxLength - (t.value?.length ?? 0)}</span>`;
|
|
62
|
-
a = n`<div class=${x(e)}>
|
|
63
|
-
${l}
|
|
64
|
-
<span> / ${t.maxLength}</span>
|
|
65
|
-
</div>`;
|
|
66
|
-
}
|
|
67
|
-
const d = {
|
|
68
|
-
height: `${t.minimumHeight}px`,
|
|
69
|
-
"min-height": `${t.minimumHeight}px`
|
|
70
|
-
}, s = this.querySelector(`textarea[id="${this.uid}"]`);
|
|
71
|
-
if (this.autoGrow && s) {
|
|
72
|
-
const e = window.getComputedStyle(s), l = parseFloat(e.paddingTop), p = parseFloat(e.paddingBottom), y = l + p;
|
|
73
|
-
s.style.height = "auto", d.height = `${Math.max(this.minimumHeight ?? 120, s.scrollHeight - y)}px`;
|
|
74
|
-
}
|
|
75
|
-
return n`
|
|
76
|
-
${C(this.uid, t)}
|
|
77
|
-
|
|
78
|
-
<div class="gui-widget">
|
|
79
|
-
<textarea
|
|
80
|
-
id=${this.uid}
|
|
81
|
-
data-cy=${`${this.uid}_textarea`}
|
|
82
|
-
class="gui-widget-input"
|
|
83
|
-
style=${D(d)}
|
|
84
|
-
?required=${t.required}
|
|
85
|
-
?disabled=${t.disabled}
|
|
86
|
-
?readonly=${t.readonly}
|
|
87
|
-
placeholder=${t.placeholder || c}
|
|
88
|
-
autocomplete=${this.autocomplete || c}
|
|
89
|
-
.value=${this.value || ""}
|
|
90
|
-
@input=${this.valueChanged}
|
|
91
|
-
@blur=${this.onBlur}
|
|
92
|
-
></textarea>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div class="gui-textarea--validation">
|
|
96
|
-
<div>${w(this.uid, t)}</div>
|
|
97
|
-
${a}
|
|
98
|
-
</div>
|
|
99
|
-
`;
|
|
100
|
-
}
|
|
101
|
-
valueChanged(t) {
|
|
102
|
-
if (t.stopPropagation(), !this.readOnly) {
|
|
103
|
-
const a = t.target;
|
|
104
|
-
this.dispatchEvent(
|
|
105
|
-
new CustomEvent("input", {
|
|
106
|
-
detail: { value: a.value },
|
|
107
|
-
bubbles: !0,
|
|
108
|
-
composed: !0
|
|
109
|
-
})
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
onBlur() {
|
|
114
|
-
this.dispatchEvent(
|
|
115
|
-
new CustomEvent("blur", {
|
|
116
|
-
bubbles: !0,
|
|
117
|
-
composed: !0
|
|
118
|
-
})
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
o([
|
|
123
|
-
i({ type: String })
|
|
124
|
-
], r.prototype, "uid", 2);
|
|
125
|
-
o([
|
|
126
|
-
i({ type: String })
|
|
127
|
-
], r.prototype, "label", 2);
|
|
128
|
-
o([
|
|
129
|
-
i({ type: String, attribute: "locale-id" })
|
|
130
|
-
], r.prototype, "localeId", 2);
|
|
131
|
-
o([
|
|
132
|
-
i({ type: Array })
|
|
133
|
-
], r.prototype, "errors", 2);
|
|
134
|
-
o([
|
|
135
|
-
i({ type: Boolean })
|
|
136
|
-
], r.prototype, "touched", 2);
|
|
137
|
-
o([
|
|
138
|
-
i({ type: Boolean })
|
|
139
|
-
], r.prototype, "required", 2);
|
|
140
|
-
o([
|
|
141
|
-
i({ type: Boolean })
|
|
142
|
-
], r.prototype, "disabled", 2);
|
|
143
|
-
o([
|
|
144
|
-
i({ type: Boolean, attribute: "readonly" })
|
|
145
|
-
], r.prototype, "readOnly", 2);
|
|
146
|
-
o([
|
|
147
|
-
i({ type: String })
|
|
148
|
-
], r.prototype, "value", 2);
|
|
149
|
-
o([
|
|
150
|
-
i({ type: String })
|
|
151
|
-
], r.prototype, "hint", 2);
|
|
152
|
-
o([
|
|
153
|
-
i({ type: String })
|
|
154
|
-
], r.prototype, "placeholder", 2);
|
|
155
|
-
o([
|
|
156
|
-
i({ type: String })
|
|
157
|
-
], r.prototype, "autocomplete", 2);
|
|
158
|
-
o([
|
|
159
|
-
i({ type: String, attribute: "countermode" })
|
|
160
|
-
], r.prototype, "counterMode", 2);
|
|
161
|
-
o([
|
|
162
|
-
i({ type: Number, attribute: "minimumheight" })
|
|
163
|
-
], r.prototype, "minimumHeight", 2);
|
|
164
|
-
o([
|
|
165
|
-
i({ type: Boolean, attribute: "autogrow" })
|
|
166
|
-
], r.prototype, "autoGrow", 2);
|
|
167
|
-
o([
|
|
168
|
-
i({ type: Number, attribute: "maxlength" })
|
|
169
|
-
], r.prototype, "maxLength", 2);
|
|
170
|
-
r = o([
|
|
171
|
-
g("gui-textarea")
|
|
172
|
-
], r);
|
|
173
|
-
typeof customElements < "u" && !customElements.get("gui-textarea") && customElements.define("gui-textarea", r);
|
|
174
|
-
var O = Object.defineProperty, E = Object.getOwnPropertyDescriptor, h = (t, a, d, s) => {
|
|
175
|
-
for (var e = s > 1 ? void 0 : s ? E(a, d) : a, l = t.length - 1, p; l >= 0; l--)
|
|
176
|
-
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
177
|
-
return s && e && O(a, d, e), e;
|
|
178
|
-
};
|
|
179
|
-
let u = class extends m {
|
|
180
|
-
constructor() {
|
|
181
|
-
super(...arguments), this.adapter = new v(), this.subscriptions = [];
|
|
182
|
-
}
|
|
183
|
-
createRenderRoot() {
|
|
184
|
-
return this;
|
|
185
|
-
}
|
|
186
|
-
updated(t) {
|
|
187
|
-
super.updated(t);
|
|
188
|
-
const a = this.adapter.templateData.size;
|
|
189
|
-
a ? this.style.flex = String(a) : this.style.removeProperty("flex");
|
|
190
|
-
}
|
|
191
|
-
connectedCallback() {
|
|
192
|
-
super.connectedCallback(), this.classList.add("gui-textarea", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
193
|
-
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
render() {
|
|
197
|
-
return super.render(), n`
|
|
198
|
-
<gui-textarea
|
|
199
|
-
.uid=${this.widget.uid}
|
|
200
|
-
.label=${this.adapter.templateData.label}
|
|
201
|
-
.errors=${this.adapter.templateData.errors}
|
|
202
|
-
?touched=${this.adapter.templateData.touched}
|
|
203
|
-
?required=${this.adapter.templateData.validator?.required}
|
|
204
|
-
?disabled=${this.adapter.templateData.disabled}
|
|
205
|
-
?readonly=${this.adapter.templateData.readonly}
|
|
206
|
-
.value=${this.adapter.templateData.value}
|
|
207
|
-
.hint=${this.adapter.templateData.hint}
|
|
208
|
-
.placeholder=${this.adapter.templateData.placeholder}
|
|
209
|
-
.autocomplete=${this.adapter.templateData.autocomplete}
|
|
210
|
-
.counterMode=${this.adapter.templateData.counterMode}
|
|
211
|
-
.minimumHeight=${this.adapter.templateData.minimumHeight}
|
|
212
|
-
.autoGrow=${this.adapter.templateData.autoGrow}
|
|
213
|
-
.maxLength=${this.adapter.templateData.validator?.maxLength}
|
|
214
|
-
@input=${this.valueChanged}
|
|
215
|
-
@blur=${() => this.adapter.onBlur()}
|
|
216
|
-
></gui-textarea>
|
|
217
|
-
`;
|
|
218
|
-
}
|
|
219
|
-
valueChanged(t) {
|
|
220
|
-
const a = t.detail.value;
|
|
221
|
-
this.adapter.valueChanged(a);
|
|
222
|
-
}
|
|
223
|
-
disconnectedCallback() {
|
|
224
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
h([
|
|
228
|
-
_({ context: b }),
|
|
229
|
-
i({ attribute: !1 })
|
|
230
|
-
], u.prototype, "formContext", 2);
|
|
231
|
-
h([
|
|
232
|
-
L({ context: $ })
|
|
233
|
-
], u.prototype, "adapter", 2);
|
|
234
|
-
u = h([
|
|
235
|
-
g("gui-textarea-input")
|
|
236
|
-
], u);
|
|
237
|
-
export {
|
|
238
|
-
u as TextareaElement
|
|
239
|
-
};
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { InputWidgetAdapter as b, formContext as v, inputContext as g } from "@golemui/lit";
|
|
2
|
-
import { LitElement as c, nothing as h, html as m } from "lit";
|
|
3
|
-
import { property as r, customElement as y } from "lit/decorators.js";
|
|
4
|
-
import { classMap as f } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as $, a as x, b as C, c as D } from "./templates-Df7abEkB.js";
|
|
6
|
-
import { consume as O, provide as _ } from "@lit/context";
|
|
7
|
-
import "rxjs";
|
|
8
|
-
var q = Object.defineProperty, w = Object.getOwnPropertyDescriptor, s = (t, e, o, l) => {
|
|
9
|
-
for (var a = l > 1 ? void 0 : l ? w(e, o) : e, p = t.length - 1, d; p >= 0; p--)
|
|
10
|
-
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
11
|
-
return l && a && q(e, o, a), a;
|
|
12
|
-
};
|
|
13
|
-
let i = class extends c {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.icon = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.ariaController = new $(this, {
|
|
16
|
-
getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
|
|
17
|
-
getState: () => ({
|
|
18
|
-
uid: this.uid,
|
|
19
|
-
templateData: {
|
|
20
|
-
hint: this.hint,
|
|
21
|
-
errors: this.errors,
|
|
22
|
-
readonly: this.readOnly,
|
|
23
|
-
disabled: this.disabled,
|
|
24
|
-
touched: this.touched,
|
|
25
|
-
required: this.required
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
createRenderRoot() {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
connectedCallback() {
|
|
34
|
-
super.connectedCallback(), this.classList.add("gui-field");
|
|
35
|
-
}
|
|
36
|
-
render() {
|
|
37
|
-
super.render();
|
|
38
|
-
const t = {
|
|
39
|
-
uid: this.uid,
|
|
40
|
-
label: this.label,
|
|
41
|
-
hint: this.hint,
|
|
42
|
-
errors: this.errors,
|
|
43
|
-
touched: this.touched,
|
|
44
|
-
required: this.required,
|
|
45
|
-
disabled: this.disabled,
|
|
46
|
-
readonly: this.readOnly,
|
|
47
|
-
value: this.value,
|
|
48
|
-
icon: this.icon,
|
|
49
|
-
placeholder: this.placeholder,
|
|
50
|
-
autocomplete: this.autocomplete
|
|
51
|
-
}, e = x("textinput", t), o = {
|
|
52
|
-
"gui-widget-input": !0,
|
|
53
|
-
"gui-textinput--icon": !!this.icon
|
|
54
|
-
};
|
|
55
|
-
return m`
|
|
56
|
-
${C(this.uid, t)}
|
|
57
|
-
|
|
58
|
-
<div class="gui-widget">
|
|
59
|
-
<input
|
|
60
|
-
type="text"
|
|
61
|
-
id=${this.uid}
|
|
62
|
-
data-cy=${`${this.uid}_textinput`}
|
|
63
|
-
class=${f(o)}
|
|
64
|
-
value=${this.value}
|
|
65
|
-
?required=${this.required}
|
|
66
|
-
?disabled=${this.disabled}
|
|
67
|
-
?readonly=${this.readOnly}
|
|
68
|
-
placeholder=${this.placeholder || h}
|
|
69
|
-
autocomplete=${this.autocomplete || h}
|
|
70
|
-
@input=${this.valueChanged}
|
|
71
|
-
@blur=${this.onBlur}
|
|
72
|
-
/>
|
|
73
|
-
${e.html}
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
${D(this.uid, t)}
|
|
77
|
-
`;
|
|
78
|
-
}
|
|
79
|
-
valueChanged(t) {
|
|
80
|
-
if (t.stopPropagation(), !this.readOnly) {
|
|
81
|
-
const e = t.target;
|
|
82
|
-
this.dispatchEvent(
|
|
83
|
-
new CustomEvent("input", {
|
|
84
|
-
detail: { value: e.value },
|
|
85
|
-
bubbles: !0,
|
|
86
|
-
composed: !0
|
|
87
|
-
})
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
onBlur() {
|
|
92
|
-
this.dispatchEvent(
|
|
93
|
-
new CustomEvent("blur", {
|
|
94
|
-
bubbles: !0,
|
|
95
|
-
composed: !0
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
s([
|
|
101
|
-
r({ type: String })
|
|
102
|
-
], i.prototype, "uid", 2);
|
|
103
|
-
s([
|
|
104
|
-
r({ type: String })
|
|
105
|
-
], i.prototype, "label", 2);
|
|
106
|
-
s([
|
|
107
|
-
r({ type: String, attribute: "locale-id" })
|
|
108
|
-
], i.prototype, "localeId", 2);
|
|
109
|
-
s([
|
|
110
|
-
r({ type: Array })
|
|
111
|
-
], i.prototype, "errors", 2);
|
|
112
|
-
s([
|
|
113
|
-
r({ type: Boolean })
|
|
114
|
-
], i.prototype, "touched", 2);
|
|
115
|
-
s([
|
|
116
|
-
r({ type: Boolean })
|
|
117
|
-
], i.prototype, "required", 2);
|
|
118
|
-
s([
|
|
119
|
-
r({ type: Boolean })
|
|
120
|
-
], i.prototype, "disabled", 2);
|
|
121
|
-
s([
|
|
122
|
-
r({ type: Boolean, attribute: "readonly" })
|
|
123
|
-
], i.prototype, "readOnly", 2);
|
|
124
|
-
s([
|
|
125
|
-
r({ type: String })
|
|
126
|
-
], i.prototype, "value", 2);
|
|
127
|
-
s([
|
|
128
|
-
r({ type: String })
|
|
129
|
-
], i.prototype, "hint", 2);
|
|
130
|
-
s([
|
|
131
|
-
r({ type: String })
|
|
132
|
-
], i.prototype, "icon", 2);
|
|
133
|
-
s([
|
|
134
|
-
r({ type: String })
|
|
135
|
-
], i.prototype, "placeholder", 2);
|
|
136
|
-
s([
|
|
137
|
-
r({ type: String })
|
|
138
|
-
], i.prototype, "autocomplete", 2);
|
|
139
|
-
i = s([
|
|
140
|
-
y("gui-textinput")
|
|
141
|
-
], i);
|
|
142
|
-
typeof customElements < "u" && !customElements.get("gui-textinput") && customElements.define("gui-textinput", i);
|
|
143
|
-
var E = Object.defineProperty, S = Object.getOwnPropertyDescriptor, u = (t, e, o, l) => {
|
|
144
|
-
for (var a = l > 1 ? void 0 : l ? S(e, o) : e, p = t.length - 1, d; p >= 0; p--)
|
|
145
|
-
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
146
|
-
return l && a && E(e, o, a), a;
|
|
147
|
-
};
|
|
148
|
-
let n = class extends c {
|
|
149
|
-
constructor() {
|
|
150
|
-
super(...arguments), this.adapter = new b(), this.subscriptions = [];
|
|
151
|
-
}
|
|
152
|
-
createRenderRoot() {
|
|
153
|
-
return this;
|
|
154
|
-
}
|
|
155
|
-
updated(t) {
|
|
156
|
-
super.updated(t);
|
|
157
|
-
const e = this.adapter.templateData.size;
|
|
158
|
-
e ? this.style.flex = String(e) : this.style.removeProperty("flex");
|
|
159
|
-
}
|
|
160
|
-
connectedCallback() {
|
|
161
|
-
super.connectedCallback(), this.classList.add("gui-textinput", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
162
|
-
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
render() {
|
|
166
|
-
return super.render(), m`
|
|
167
|
-
<gui-textinput
|
|
168
|
-
.uid=${this.widget.uid}
|
|
169
|
-
.label=${this.adapter.templateData.label}
|
|
170
|
-
.hint=${this.adapter.templateData.hint}
|
|
171
|
-
.errors=${this.adapter.templateData.errors}
|
|
172
|
-
?touched=${this.adapter.templateData.touched}
|
|
173
|
-
?required=${this.adapter.templateData.validator?.required}
|
|
174
|
-
?disabled=${this.adapter.templateData.disabled}
|
|
175
|
-
?readonly=${this.adapter.templateData.readonly}
|
|
176
|
-
.value=${this.adapter.templateData.value}
|
|
177
|
-
.icon=${this.adapter.templateData.icon}
|
|
178
|
-
.placeholder=${this.adapter.templateData.placeholder}
|
|
179
|
-
.autocomplete=${this.adapter.templateData.autocomplete}
|
|
180
|
-
@input=${this.valueChanged}
|
|
181
|
-
@blur=${() => this.adapter.onBlur()}
|
|
182
|
-
></gui-textinput>
|
|
183
|
-
`;
|
|
184
|
-
}
|
|
185
|
-
valueChanged(t) {
|
|
186
|
-
const e = t.detail.value;
|
|
187
|
-
this.adapter.valueChanged(e);
|
|
188
|
-
}
|
|
189
|
-
disconnectedCallback() {
|
|
190
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
u([
|
|
194
|
-
O({ context: v }),
|
|
195
|
-
r({ attribute: !1 })
|
|
196
|
-
], n.prototype, "formContext", 2);
|
|
197
|
-
u([
|
|
198
|
-
_({ context: g })
|
|
199
|
-
], n.prototype, "adapter", 2);
|
|
200
|
-
n = u([
|
|
201
|
-
y("gui-textinput-input")
|
|
202
|
-
], n);
|
|
203
|
-
export {
|
|
204
|
-
n as TextinputElement
|
|
205
|
-
};
|