@golemui/gui-lit 1.0.3 → 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 +26 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/calendar-D31xNsxx.js +267 -0
- package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
- package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
- package/date-input-DLiMreSS.js +204 -0
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/date-time-calendar-DzU-FtVl.js +374 -0
- package/date-time-calendar.element-BLBcVsFu.js +95 -0
- package/date-time-input-DZaz2heD.js +246 -0
- package/date-time-picker.element-BUbLdV6i.js +440 -0
- package/date-time.element-B5onfSBG.js +93 -0
- package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
- package/day-status-CsWStVQV.js +554 -0
- package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/focus-leave.controller-2gV0pQd5.js +73 -0
- package/index.js +1635 -948
- package/index.umd.cjs +2046 -601
- 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-D730tmGN.js +297 -0
- package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
- 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-VORbpgs2.js +691 -0
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/pill-ranges-DpvWwP-3.js +48 -0
- package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/range-calendar-DO_woqcF.js +466 -0
- package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
- package/range-commit-8-MmYUyo.js +14 -0
- package/range-date-input-Br7XqQPK.js +311 -0
- package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
- package/range-date-picker.element-DWRHiAoC.js +434 -0
- package/range-date-time-calendar-B3EMgN1E.js +734 -0
- package/range-date-time-calendar.element-Coea6RF4.js +97 -0
- package/range-date-time-input-Cu-T_nuC.js +353 -0
- package/range-date-time-input.element-Cti44iuW.js +87 -0
- package/range-date-time-picker.element-CDN2RL1y.js +472 -0
- package/range-selection-CU3hxLJE.js +25 -0
- package/range-time-input-BP9ZL9O8.js +348 -0
- package/range-time-input.element-B7wtHJoQ.js +84 -0
- package/range-time-picker.element-CPIAiQPC.js +470 -0
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-CX3vQL8L.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-5dkSm8UW.js +201 -0
- package/time-list-DLcq8BAp.js +217 -0
- package/time-picker-g337F8d0.js +299 -0
- package/time-picker.element-DLihegjg.js +89 -0
- package/time.element-BneqgMlQ.js +85 -0
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- 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/list-D1oKnH89.js +0 -283
- 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/templates-Dk1jxLwS.js +0 -75
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
1
|
+
import { InputWidgetAdapter as m, formContext as b, inputContext as y } from "@golemui/lit";
|
|
2
2
|
import { LitElement as v, html as n, nothing as u } from "lit";
|
|
3
3
|
import { repeat as f } from "lit-html/directives/repeat.js";
|
|
4
|
-
import { property as
|
|
4
|
+
import { property as a, customElement as g } from "lit/decorators.js";
|
|
5
5
|
import { classMap as $ } from "lit/directives/class-map.js";
|
|
6
|
-
import { G as C, a as D, b as w, c as
|
|
7
|
-
import { u as
|
|
8
|
-
import { consume as
|
|
6
|
+
import { G as C, a as D, b as w, c as O } from "./templates-Dmr34nwp.js";
|
|
7
|
+
import { u as E, i as S } from "./one-of-C0ur6b_n.js";
|
|
8
|
+
import { consume as F, provide as _ } from "@lit/context";
|
|
9
9
|
import "rxjs";
|
|
10
|
-
var
|
|
11
|
-
for (var o =
|
|
12
|
-
(p =
|
|
13
|
-
return
|
|
10
|
+
var x = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (e, i, r, l) => {
|
|
11
|
+
for (var o = l > 1 ? void 0 : l ? q(i, r) : i, d = e.length - 1, p; d >= 0; d--)
|
|
12
|
+
(p = e[d]) && (o = (l ? p(i, r, o) : p(o)) || o);
|
|
13
|
+
return l && o && x(i, r, o), o;
|
|
14
14
|
};
|
|
15
|
-
let
|
|
15
|
+
let t = class extends v {
|
|
16
16
|
constructor() {
|
|
17
|
-
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.autocomplete = void 0, this.options = [], this.placeholder = void 0, this.labelField = void 0, this.valueField = void 0, this.optionsLoading = !1, this.hasMatchingValue = !1, this.ariaController = new C(this, {
|
|
17
|
+
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.autocomplete = void 0, this.options = [], this.placeholder = void 0, this.invalidOptionMessage = void 0, this.labelField = void 0, this.valueField = void 0, this.optionsLoading = !1, this.hasMatchingValue = !1, this.ariaController = new C(this, {
|
|
18
18
|
getTargets: () => this.querySelectorAll(`select[id="${this.uid}"]`),
|
|
19
19
|
getState: () => ({
|
|
20
20
|
uid: this.uid,
|
|
@@ -23,7 +23,8 @@ let a = class extends v {
|
|
|
23
23
|
errors: this.errors,
|
|
24
24
|
readonly: this.readOnly,
|
|
25
25
|
disabled: this.disabled,
|
|
26
|
-
touched: this.touched
|
|
26
|
+
touched: this.touched,
|
|
27
|
+
required: this.required
|
|
27
28
|
}
|
|
28
29
|
})
|
|
29
30
|
});
|
|
@@ -36,7 +37,7 @@ let a = class extends v {
|
|
|
36
37
|
}
|
|
37
38
|
render() {
|
|
38
39
|
super.render();
|
|
39
|
-
const
|
|
40
|
+
const e = {
|
|
40
41
|
uid: this.uid,
|
|
41
42
|
label: this.label,
|
|
42
43
|
errors: this.errors,
|
|
@@ -52,37 +53,36 @@ let a = class extends v {
|
|
|
52
53
|
placeholder: this.placeholder,
|
|
53
54
|
labelField: this.labelField,
|
|
54
55
|
valueField: this.valueField
|
|
55
|
-
},
|
|
56
|
-
this.options =
|
|
56
|
+
}, i = D("select", e);
|
|
57
|
+
this.options = E(this.options, {
|
|
57
58
|
labelField: this.labelField,
|
|
58
59
|
valueField: this.valueField
|
|
59
|
-
}), this.hasMatchingValue = this.options?.length ? this.options.find(({ value:
|
|
60
|
+
}), this.hasMatchingValue = this.options?.length ? this.options.find(({ value: l }) => l === this.value) !== void 0 : !1;
|
|
60
61
|
const r = this.optionsLoading ? n`<span>Loading...</span>` : n`
|
|
61
62
|
<option value="" disabled selected=${this.hasMatchingValue ? u : ""}>
|
|
62
63
|
${this.placeholder ?? "Select an option"}
|
|
63
64
|
</option>
|
|
64
65
|
${f(
|
|
65
66
|
this.options || [],
|
|
66
|
-
(
|
|
67
|
-
(
|
|
68
|
-
value=${
|
|
69
|
-
selected=${this.hasMatchingValue &&
|
|
67
|
+
(l) => l?.value,
|
|
68
|
+
(l) => n`<option
|
|
69
|
+
value=${l.value}
|
|
70
|
+
selected=${this.hasMatchingValue && l.value === this.value ? "" : u}
|
|
70
71
|
>
|
|
71
|
-
${
|
|
72
|
+
${l.label}
|
|
72
73
|
</option>`
|
|
73
74
|
)}
|
|
74
75
|
`;
|
|
75
76
|
return n`
|
|
76
|
-
${w(this.uid,
|
|
77
|
+
${w(this.uid, e)}
|
|
77
78
|
|
|
78
79
|
<div class="gui-widget">
|
|
79
80
|
<select
|
|
80
81
|
id=${this.uid}
|
|
81
|
-
tabindex="0"
|
|
82
82
|
data-cy=${`${this.uid}_select`}
|
|
83
|
-
class=${$({ "gui-widget-input": !0, ...
|
|
84
|
-
?required=${
|
|
85
|
-
?disabled=${
|
|
83
|
+
class=${$({ "gui-widget-input": !0, ...i.widgetClasses })}
|
|
84
|
+
?required=${e.required}
|
|
85
|
+
?disabled=${e.disabled || e.readonly}
|
|
86
86
|
autocomplete=${this.autocomplete || u}
|
|
87
87
|
@change=${this.valueChanged}
|
|
88
88
|
@blur=${this.onBlur}
|
|
@@ -90,33 +90,39 @@ let a = class extends v {
|
|
|
90
90
|
${r}
|
|
91
91
|
</select>
|
|
92
92
|
<span class="gui-select__arrow"
|
|
93
|
-
><svg
|
|
93
|
+
><svg
|
|
94
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
95
|
+
width="16"
|
|
96
|
+
height="16"
|
|
97
|
+
viewBox="0 0 256 256"
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
>
|
|
94
100
|
<path
|
|
95
101
|
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"
|
|
96
102
|
></path></svg
|
|
97
103
|
></span>
|
|
98
|
-
${
|
|
104
|
+
${i.html}
|
|
99
105
|
</div>
|
|
100
106
|
|
|
101
|
-
${
|
|
107
|
+
${O(this.uid, e)}
|
|
102
108
|
`;
|
|
103
109
|
}
|
|
104
|
-
updated(
|
|
105
|
-
|
|
110
|
+
updated(e) {
|
|
111
|
+
e.has("value") && !this.hasMatchingValue && this.value && this.dispatchEvent(
|
|
106
112
|
new CustomEvent("inputError", {
|
|
107
113
|
detail: {
|
|
108
|
-
message:
|
|
114
|
+
message: (this.invalidOptionMessage ?? "Invalid selection: '{value}' is not a valid option.").replace("{value}", String(this.value))
|
|
109
115
|
},
|
|
110
116
|
bubbles: !0
|
|
111
117
|
})
|
|
112
118
|
);
|
|
113
119
|
}
|
|
114
|
-
valueChanged(
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
120
|
+
valueChanged(e) {
|
|
121
|
+
if (e.stopPropagation(), !this.readOnly) {
|
|
122
|
+
const i = e.target;
|
|
117
123
|
this.dispatchEvent(
|
|
118
124
|
new CustomEvent("change", {
|
|
119
|
-
detail: { value: S(
|
|
125
|
+
detail: { value: S(i.value, this.options) },
|
|
120
126
|
bubbles: !0,
|
|
121
127
|
composed: !0
|
|
122
128
|
})
|
|
@@ -132,74 +138,77 @@ let a = class extends v {
|
|
|
132
138
|
);
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
],
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
],
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
],
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
],
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
],
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
],
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
],
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
],
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
],
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
],
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
],
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
],
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
],
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
141
|
+
s([
|
|
142
|
+
a({ type: String })
|
|
143
|
+
], t.prototype, "uid", 2);
|
|
144
|
+
s([
|
|
145
|
+
a({ type: String })
|
|
146
|
+
], t.prototype, "label", 2);
|
|
147
|
+
s([
|
|
148
|
+
a({ type: String, attribute: "locale-id" })
|
|
149
|
+
], t.prototype, "localeId", 2);
|
|
150
|
+
s([
|
|
151
|
+
a({ type: Array })
|
|
152
|
+
], t.prototype, "errors", 2);
|
|
153
|
+
s([
|
|
154
|
+
a({ type: Boolean })
|
|
155
|
+
], t.prototype, "touched", 2);
|
|
156
|
+
s([
|
|
157
|
+
a({ type: Boolean })
|
|
158
|
+
], t.prototype, "required", 2);
|
|
159
|
+
s([
|
|
160
|
+
a({ type: Boolean })
|
|
161
|
+
], t.prototype, "disabled", 2);
|
|
162
|
+
s([
|
|
163
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
164
|
+
], t.prototype, "readOnly", 2);
|
|
165
|
+
s([
|
|
166
|
+
a({ type: String })
|
|
167
|
+
], t.prototype, "value", 2);
|
|
168
|
+
s([
|
|
169
|
+
a({ type: String })
|
|
170
|
+
], t.prototype, "hint", 2);
|
|
171
|
+
s([
|
|
172
|
+
a({ type: String })
|
|
173
|
+
], t.prototype, "icon", 2);
|
|
174
|
+
s([
|
|
175
|
+
a({ type: String })
|
|
176
|
+
], t.prototype, "autocomplete", 2);
|
|
177
|
+
s([
|
|
178
|
+
a({ type: Array })
|
|
179
|
+
], t.prototype, "options", 2);
|
|
180
|
+
s([
|
|
181
|
+
a({ type: String })
|
|
182
|
+
], t.prototype, "placeholder", 2);
|
|
183
|
+
s([
|
|
184
|
+
a({ type: String, attribute: "invalid-option-message" })
|
|
185
|
+
], t.prototype, "invalidOptionMessage", 2);
|
|
186
|
+
s([
|
|
187
|
+
a({ type: String })
|
|
188
|
+
], t.prototype, "labelField", 2);
|
|
189
|
+
s([
|
|
190
|
+
a({ type: String })
|
|
191
|
+
], t.prototype, "valueField", 2);
|
|
192
|
+
t = s([
|
|
193
|
+
g("gui-select")
|
|
194
|
+
], t);
|
|
195
|
+
typeof customElements < "u" && !customElements.get("gui-select") && customElements.define("gui-select", t);
|
|
196
|
+
var M = Object.defineProperty, I = Object.getOwnPropertyDescriptor, c = (e, i, r, l) => {
|
|
197
|
+
for (var o = l > 1 ? void 0 : l ? I(i, r) : i, d = e.length - 1, p; d >= 0; d--)
|
|
198
|
+
(p = e[d]) && (o = (l ? p(i, r, o) : p(o)) || o);
|
|
199
|
+
return l && o && M(i, r, o), o;
|
|
191
200
|
};
|
|
192
201
|
let h = class extends v {
|
|
193
202
|
constructor() {
|
|
194
|
-
super(...arguments), this.adapter = new
|
|
203
|
+
super(...arguments), this.adapter = new m(), this.subscriptions = [];
|
|
195
204
|
}
|
|
196
205
|
createRenderRoot() {
|
|
197
206
|
return this;
|
|
198
207
|
}
|
|
199
|
-
updated(
|
|
200
|
-
super.updated(
|
|
201
|
-
const
|
|
202
|
-
|
|
208
|
+
updated(e) {
|
|
209
|
+
super.updated(e);
|
|
210
|
+
const i = this.adapter.templateData.size;
|
|
211
|
+
i ? this.style.flex = String(i) : this.style.removeProperty("flex");
|
|
203
212
|
}
|
|
204
213
|
connectedCallback() {
|
|
205
214
|
super.connectedCallback(), this.classList.add("gui-select", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
@@ -224,32 +233,33 @@ let h = class extends v {
|
|
|
224
233
|
.options=${this.adapter.templateData.options}
|
|
225
234
|
.labelField=${this.adapter.templateData.labelField}
|
|
226
235
|
.valueField=${this.adapter.templateData.valueField}
|
|
236
|
+
.invalidOptionMessage=${this.adapter.templateData.invalidOptionMessage}
|
|
227
237
|
@change=${this.valueChanged}
|
|
228
238
|
@inputError=${this.onInputError}
|
|
229
239
|
@blur=${() => this.adapter.onBlur()}
|
|
230
240
|
></gui-select>
|
|
231
241
|
`;
|
|
232
242
|
}
|
|
233
|
-
valueChanged(
|
|
234
|
-
const
|
|
235
|
-
this.adapter.valueChanged(
|
|
243
|
+
valueChanged(e) {
|
|
244
|
+
const i = e.detail.value;
|
|
245
|
+
this.adapter.valueChanged(i);
|
|
236
246
|
}
|
|
237
|
-
onInputError(
|
|
238
|
-
this.adapter.injectValidationIssues([
|
|
247
|
+
onInputError(e) {
|
|
248
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
239
249
|
}
|
|
240
250
|
disconnectedCallback() {
|
|
241
|
-
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((
|
|
251
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
242
252
|
}
|
|
243
253
|
};
|
|
244
254
|
c([
|
|
245
|
-
|
|
246
|
-
|
|
255
|
+
F({ context: b }),
|
|
256
|
+
a({ attribute: !1 })
|
|
247
257
|
], h.prototype, "formContext", 2);
|
|
248
258
|
c([
|
|
249
|
-
|
|
259
|
+
_({ context: y })
|
|
250
260
|
], h.prototype, "adapter", 2);
|
|
251
261
|
h = c([
|
|
252
|
-
|
|
262
|
+
g("gui-select-input")
|
|
253
263
|
], h);
|
|
254
264
|
export {
|
|
255
265
|
h as SelectElement
|
|
@@ -89,6 +89,7 @@ let n = class extends y {
|
|
|
89
89
|
(e) => e?.uid,
|
|
90
90
|
(e, t) => d`<section
|
|
91
91
|
role="tabpanel"
|
|
92
|
+
tabindex="0"
|
|
92
93
|
data-cy=${`tabpanel_${this.widget.uid}_${t}`}
|
|
93
94
|
id=${`tabpanel_${this.widget.uid}_${t}`}
|
|
94
95
|
?hidden=${e.uid !== this.activeTab && this.adapter.templateData.renderMode !== "activeOnly"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { InputWidgetAdapter as D, formContext as w, inputContext as C } from "@golemui/lit";
|
|
2
2
|
import { LitElement as y, nothing as c, html as m } from "lit";
|
|
3
|
-
import { property as o, customElement as
|
|
3
|
+
import { property as o, customElement as b } from "lit/decorators.js";
|
|
4
4
|
import { classMap as f } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as A, b as P, c as S } from "./templates-
|
|
6
|
-
import "./pills-
|
|
5
|
+
import { G as A, b as P, c as S } from "./templates-Dmr34nwp.js";
|
|
6
|
+
import "./pills-BDMO2NiR.js";
|
|
7
7
|
import { styleMap as _ } from "lit-html/directives/style-map.js";
|
|
8
|
-
import { consume as E, provide as
|
|
8
|
+
import { consume as E, provide as L } from "@lit/context";
|
|
9
9
|
import "rxjs";
|
|
10
|
-
var
|
|
11
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
10
|
+
var O = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, e, r, a) => {
|
|
11
|
+
for (var i = a > 1 ? void 0 : a ? I(e, r) : e, s = t.length - 1, p; s >= 0; s--)
|
|
12
12
|
(p = t[s]) && (i = (a ? p(e, r, i) : p(i)) || i);
|
|
13
|
-
return a && i &&
|
|
13
|
+
return a && i && O(e, r, i), i;
|
|
14
14
|
};
|
|
15
15
|
const x = ["Enter", ",", "Tab", "blur"];
|
|
16
16
|
let l = class extends y {
|
|
@@ -24,7 +24,8 @@ let l = class extends y {
|
|
|
24
24
|
errors: this.errors,
|
|
25
25
|
readonly: this.readOnly,
|
|
26
26
|
disabled: this.disabled,
|
|
27
|
-
touched: this.touched
|
|
27
|
+
touched: this.touched,
|
|
28
|
+
required: this.required
|
|
28
29
|
}
|
|
29
30
|
})
|
|
30
31
|
}), this.onPillRemove = (t) => {
|
|
@@ -87,11 +88,17 @@ let l = class extends y {
|
|
|
87
88
|
role="group"
|
|
88
89
|
aria-label=${this.label ?? "Tags input"}
|
|
89
90
|
>
|
|
90
|
-
${this.icon ? m`<span
|
|
91
|
+
${this.icon ? m`<span
|
|
92
|
+
class=${f(r)}
|
|
93
|
+
data-icon=${this.icon}
|
|
94
|
+
aria-hidden="true"
|
|
95
|
+
></span>` : c}
|
|
91
96
|
|
|
92
97
|
<gui-pills
|
|
93
98
|
class="gui-tags__pills"
|
|
94
99
|
style=${_(a.length ? {} : { "min-width": 0 })}
|
|
100
|
+
.uid=${this.uid}
|
|
101
|
+
.toolbarAriaLabel=${"Selected tags"}
|
|
95
102
|
.items=${a}
|
|
96
103
|
.removable=${!0}
|
|
97
104
|
.clickable=${!1}
|
|
@@ -179,8 +186,8 @@ let l = class extends y {
|
|
|
179
186
|
);
|
|
180
187
|
if (!i.test(e)) return;
|
|
181
188
|
t.preventDefault();
|
|
182
|
-
const s = t.target instanceof HTMLInputElement ? t.target : null, d = ((s?.value ?? "") + e).split(i),
|
|
183
|
-
this.commitDraftBatch(
|
|
189
|
+
const s = t.target instanceof HTMLInputElement ? t.target : null, d = ((s?.value ?? "") + e).split(i), v = d.slice(0, -1), $ = d[d.length - 1] ?? "";
|
|
190
|
+
this.commitDraftBatch(v) && s && (s.value = $);
|
|
184
191
|
}
|
|
185
192
|
commitDraft(t) {
|
|
186
193
|
const e = this.trim ? t.trim() : t;
|
|
@@ -289,7 +296,7 @@ n([
|
|
|
289
296
|
o({ type: String, attribute: "remove-icon" })
|
|
290
297
|
], l.prototype, "removeIcon", 2);
|
|
291
298
|
l = n([
|
|
292
|
-
|
|
299
|
+
b("gui-tags")
|
|
293
300
|
], l);
|
|
294
301
|
typeof customElements < "u" && !customElements.get("gui-tags") && customElements.define("gui-tags", l);
|
|
295
302
|
var q = Object.defineProperty, R = Object.getOwnPropertyDescriptor, g = (t, e, r, a) => {
|
|
@@ -352,10 +359,10 @@ g([
|
|
|
352
359
|
o({ attribute: !1 })
|
|
353
360
|
], h.prototype, "formContext", 2);
|
|
354
361
|
g([
|
|
355
|
-
|
|
362
|
+
L({ context: C })
|
|
356
363
|
], h.prototype, "adapter", 2);
|
|
357
364
|
h = g([
|
|
358
|
-
|
|
365
|
+
b("gui-tags-input")
|
|
359
366
|
], h);
|
|
360
367
|
export {
|
|
361
368
|
h as TagsElement
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { filterTap as C } from "@golemui/core";
|
|
2
|
+
import { html as i, nothing as o } from "lit";
|
|
3
|
+
import { classMap as f } from "lit/directives/class-map.js";
|
|
4
|
+
class E {
|
|
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: _, errors: c, readonly: v, disabled: A, hint: y, required: q } = n, d = _ && c && c.length > 0;
|
|
16
|
+
C(
|
|
17
|
+
e,
|
|
18
|
+
(t) => !!t,
|
|
19
|
+
(t) => {
|
|
20
|
+
const a = ($, u) => {
|
|
21
|
+
u ? t.setAttribute($, u) : t.removeAttribute($);
|
|
22
|
+
};
|
|
23
|
+
a("aria-describedby", y ? `${l}_hint` : null), a("aria-invalid", d ? "true" : null), a("aria-errormessage", d ? `${l}_errors` : null), a("aria-readonly", v ? "true" : null), a("aria-disabled", A ? "true" : null), a("aria-required", q ? "true" : null);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const g = (s) => s ? i`<span aria-hidden="true"> *</span>` : o, G = (s, r, e = !1, l = void 0, n = !0) => n ? r.label ? i`<label
|
|
29
|
+
class="gui-label"
|
|
30
|
+
for=${s}
|
|
31
|
+
data-cy=${`${s}_label`}
|
|
32
|
+
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
33
|
+
>
|
|
34
|
+
${r.label}${g(r.required)}
|
|
35
|
+
${h(s, r)} ${e ? b(s, r) : o}
|
|
36
|
+
</label>` : o : r.label ? i`<span
|
|
37
|
+
class="gui-label"
|
|
38
|
+
data-cy=${`${s}_label`}
|
|
39
|
+
id=${l ? `${s}_${l}_label` : `${s}_label`}
|
|
40
|
+
>
|
|
41
|
+
${r.label}${g(r.required)}
|
|
42
|
+
${h(s, r)} ${e ? b(s, r) : o}
|
|
43
|
+
</span>` : o, h = (s, r) => r.hint ? i`<div class="gui-widget-hint" id=${`${s}_hint`}>${r.hint}</div>` : i``, I = (s, r) => {
|
|
44
|
+
const e = {
|
|
45
|
+
[`gui-${s}--icon`]: !1,
|
|
46
|
+
[`gui-${s}--icon-right`]: !1
|
|
47
|
+
};
|
|
48
|
+
if (r.icon) {
|
|
49
|
+
e[`gui-${s}--icon`] = !0;
|
|
50
|
+
const l = {
|
|
51
|
+
"gui-widget-icon": !0,
|
|
52
|
+
[r.icon]: !0
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
widgetClasses: e,
|
|
56
|
+
html: i`<span
|
|
57
|
+
class=${f(l)}
|
|
58
|
+
data-icon=${r.icon}
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
></span>`
|
|
61
|
+
};
|
|
62
|
+
} else
|
|
63
|
+
return { widgetClasses: e, html: i`` };
|
|
64
|
+
}, b = (s, r) => {
|
|
65
|
+
const e = r.touched && r.errors && r.errors.length > 0;
|
|
66
|
+
return i`<ul
|
|
67
|
+
class=${f({
|
|
68
|
+
"gui-validator": !0,
|
|
69
|
+
"gui-validator--empty": !e
|
|
70
|
+
})}
|
|
71
|
+
id=${`${s}_errors`}
|
|
72
|
+
role="alert"
|
|
73
|
+
data-cy=${e ? `${s}_validator-errors` : o}
|
|
74
|
+
>
|
|
75
|
+
${e ? r.errors?.map(
|
|
76
|
+
(n) => i`<li class="gui-validator__error" data-cy=${`${s}_validator-error`}>
|
|
77
|
+
${n}
|
|
78
|
+
</li>`
|
|
79
|
+
) : o}
|
|
80
|
+
</ul>`;
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
E as G,
|
|
84
|
+
I as a,
|
|
85
|
+
G as b,
|
|
86
|
+
b as c,
|
|
87
|
+
g as r
|
|
88
|
+
};
|
|
@@ -2,12 +2,12 @@ import { InputWidgetAdapter as v, formContext as b, inputContext as $ } from "@g
|
|
|
2
2
|
import { LitElement as m, html as n, nothing as c } from "lit";
|
|
3
3
|
import { property as i, customElement as g } from "lit/decorators.js";
|
|
4
4
|
import { classMap as x } from "lit/directives/class-map.js";
|
|
5
|
-
import { G as f, b as C, c as w } from "./templates-
|
|
5
|
+
import { G as f, b as C, c as w } from "./templates-Dmr34nwp.js";
|
|
6
6
|
import { styleMap as D } from "lit-html/directives/style-map.js";
|
|
7
7
|
import { consume as _, provide as L } from "@lit/context";
|
|
8
8
|
import "rxjs";
|
|
9
|
-
var S = Object.defineProperty,
|
|
10
|
-
for (var e = s > 1 ? void 0 : s ?
|
|
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
11
|
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
12
12
|
return s && e && S(a, d, e), e;
|
|
13
13
|
};
|
|
@@ -22,7 +22,8 @@ let r = class extends m {
|
|
|
22
22
|
errors: this.errors,
|
|
23
23
|
readonly: this.readOnly,
|
|
24
24
|
disabled: this.disabled,
|
|
25
|
-
touched: this.touched
|
|
25
|
+
touched: this.touched,
|
|
26
|
+
required: this.required
|
|
26
27
|
}
|
|
27
28
|
})
|
|
28
29
|
});
|
|
@@ -170,10 +171,10 @@ r = o([
|
|
|
170
171
|
g("gui-textarea")
|
|
171
172
|
], r);
|
|
172
173
|
typeof customElements < "u" && !customElements.get("gui-textarea") && customElements.define("gui-textarea", r);
|
|
173
|
-
var
|
|
174
|
-
for (var e = s > 1 ? void 0 : s ?
|
|
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--)
|
|
175
176
|
(p = t[l]) && (e = (s ? p(a, d, e) : p(e)) || e);
|
|
176
|
-
return s && e &&
|
|
177
|
+
return s && e && O(a, d, e), e;
|
|
177
178
|
};
|
|
178
179
|
let u = class extends m {
|
|
179
180
|
constructor() {
|
|
@@ -2,13 +2,13 @@ import { InputWidgetAdapter as b, formContext as v, inputContext as g } from "@g
|
|
|
2
2
|
import { LitElement as c, nothing as h, html as m } from "lit";
|
|
3
3
|
import { property as r, customElement as y } from "lit/decorators.js";
|
|
4
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-
|
|
5
|
+
import { G as $, a as x, b as C, c as D } from "./templates-Dmr34nwp.js";
|
|
6
6
|
import { consume as O, provide as _ } from "@lit/context";
|
|
7
7
|
import "rxjs";
|
|
8
|
-
var
|
|
9
|
-
for (var a = l > 1 ? void 0 : l ?
|
|
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
10
|
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
11
|
-
return l && a &&
|
|
11
|
+
return l && a && q(e, o, a), a;
|
|
12
12
|
};
|
|
13
13
|
let i = class extends c {
|
|
14
14
|
constructor() {
|
|
@@ -21,7 +21,8 @@ let i = class extends c {
|
|
|
21
21
|
errors: this.errors,
|
|
22
22
|
readonly: this.readOnly,
|
|
23
23
|
disabled: this.disabled,
|
|
24
|
-
touched: this.touched
|
|
24
|
+
touched: this.touched,
|
|
25
|
+
required: this.required
|
|
25
26
|
}
|
|
26
27
|
})
|
|
27
28
|
});
|
|
@@ -61,7 +62,7 @@ let i = class extends c {
|
|
|
61
62
|
data-cy=${`${this.uid}_textinput`}
|
|
62
63
|
class=${f(o)}
|
|
63
64
|
value=${this.value}
|
|
64
|
-
?required=${this.
|
|
65
|
+
?required=${this.required}
|
|
65
66
|
?disabled=${this.disabled}
|
|
66
67
|
?readonly=${this.readOnly}
|
|
67
68
|
placeholder=${this.placeholder || h}
|
|
@@ -139,10 +140,10 @@ i = s([
|
|
|
139
140
|
y("gui-textinput")
|
|
140
141
|
], i);
|
|
141
142
|
typeof customElements < "u" && !customElements.get("gui-textinput") && customElements.define("gui-textinput", i);
|
|
142
|
-
var
|
|
143
|
-
for (var a = l > 1 ? void 0 : l ?
|
|
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--)
|
|
144
145
|
(d = t[p]) && (a = (l ? d(e, o, a) : d(a)) || a);
|
|
145
|
-
return l && a &&
|
|
146
|
+
return l && a && E(e, o, a), a;
|
|
146
147
|
};
|
|
147
148
|
let n = class extends c {
|
|
148
149
|
constructor() {
|