@golemui/gui-lit 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.
Files changed (83) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/abstract-calendar-YDgwwbqe.js +528 -0
  3. package/{accordion.element-81uTv6Ms.js → accordion.element-ChLmV6QT.js} +24 -22
  4. package/{alert.element-DWrS5ggK.js → alert.element-9QFlqjj9.js} +23 -21
  5. package/button.element-ATNRRDN3.js +121 -0
  6. package/calendar-P9DzVryu.js +96 -0
  7. package/{calendar.element-C1rLK7aY.js → calendar.element-O2of7VBr.js} +25 -22
  8. package/checkbox.element-DMmer4Jw.js +199 -0
  9. package/currency.element-C7SZkoPP.js +266 -0
  10. package/date-CG1562vW.js +786 -0
  11. package/date-input-VJG8lMVN.js +266 -0
  12. package/{date-picker.element-GNC8f3Qi.js → date-picker.element-Bcyhc0fb.js} +29 -25
  13. package/{date.element-Dzw-UJzC.js → date.element-DfXmcgZi.js} +25 -22
  14. package/{dropdown.element-CebROj9s.js → dropdown.element-DCUI5Y7I.js} +24 -22
  15. package/errors-QjKhr6mA.js +109 -0
  16. package/{flex.element-BMqqfxjI.js → flex.element-B0sG0YT1.js} +24 -22
  17. package/{grid.element-CBMoOuLt.js → grid.element-Bf5aEjkj.js} +24 -22
  18. package/index.js +2708 -1174
  19. package/index.umd.cjs +982 -108
  20. package/lib/components/accordion.element.d.ts +7 -7
  21. package/lib/components/alert.element.d.ts +6 -6
  22. package/lib/components/button.element.d.ts +6 -6
  23. package/lib/components/calendar.element.d.ts +6 -6
  24. package/lib/components/checkbox.element.d.ts +6 -6
  25. package/lib/components/currency.element.d.ts +6 -6
  26. package/lib/components/date-picker.element.d.ts +6 -6
  27. package/lib/components/date.element.d.ts +6 -6
  28. package/lib/components/dropdown.element.d.ts +6 -6
  29. package/lib/components/flex.element.d.ts +6 -6
  30. package/lib/components/grid.element.d.ts +6 -6
  31. package/lib/components/list.element.d.ts +6 -6
  32. package/lib/components/markdown-text.element.d.ts +6 -6
  33. package/lib/components/markdown.element.d.ts +6 -6
  34. package/lib/components/number.element.d.ts +6 -6
  35. package/lib/components/password.element.d.ts +6 -6
  36. package/lib/components/radiogroup.element.d.ts +6 -6
  37. package/lib/components/range-calendar.element.d.ts +6 -6
  38. package/lib/components/range-date-input.element.d.ts +6 -6
  39. package/lib/components/range-date-picker.element.d.ts +6 -6
  40. package/lib/components/renderer.element.d.ts +6 -6
  41. package/lib/components/repeater.element.d.ts +6 -6
  42. package/lib/components/select.element.d.ts +6 -6
  43. package/lib/components/tabs.element.d.ts +6 -6
  44. package/lib/components/textarea.element.d.ts +6 -6
  45. package/lib/components/textinput.element.d.ts +6 -6
  46. package/lib/components/toggle.element.d.ts +6 -6
  47. package/lib/widget.loaders.d.ts +2 -2
  48. package/list-CtFsv7GB.js +284 -0
  49. package/{list.element-DIIgN_Ww.js → list.element-G8RNRZXU.js} +30 -27
  50. package/markdown-text-X-BRJT6K.js +30 -0
  51. package/{markdown-text.element-DY7b-dU5.js → markdown-text.element-C_1OqrGa.js} +23 -20
  52. package/markdown.element-CT1JOOM3.js +596 -0
  53. package/number.element-HaXEg_7U.js +282 -0
  54. package/one-of-DifUsEYY.js +48 -0
  55. package/package.json +6 -6
  56. package/password.element-B4-0SCe4.js +238 -0
  57. package/radiogroup.element-DzHLgRh1.js +232 -0
  58. package/range-calendar-qpakwAba.js +326 -0
  59. package/{range-calendar.element-Bli9UfhN.js → range-calendar.element-C-4qqRGK.js} +20 -17
  60. package/range-date-input-CrNpOVHt.js +507 -0
  61. package/{range-date-input.element-BwPvGk5F.js → range-date-input.element-Iq5Y7uLQ.js} +20 -17
  62. package/{range-date-picker.element-DJQOwDPh.js → range-date-picker.element-4bg4Uraq.js} +29 -25
  63. package/{renderer.element-B99qD2mz.js → renderer.element-DMsheQGi.js} +19 -17
  64. package/{repeater.element-AaifWsOB.js → repeater.element-Ry8HyMfW.js} +41 -27
  65. package/select.element-DuGZjlZY.js +257 -0
  66. package/tabs-DzSCq_98.js +13 -0
  67. package/{tabs.element-k8JMNDXi.js → tabs.element-VLrtF1j5.js} +31 -29
  68. package/templates-Dk1jxLwS.js +75 -0
  69. package/textarea.element-C8yx2u0o.js +237 -0
  70. package/textinput.element-DKuplF1A.js +204 -0
  71. package/toggle.element-NXRrhALB.js +201 -0
  72. package/button.element-hjhVBamJ.js +0 -56
  73. package/checkbox.element-bu9_MvED.js +0 -65
  74. package/currency.element-Bxv2WxAx.js +0 -72
  75. package/default-list-item-renderer-DNVEjKSX.js +0 -23
  76. package/markdown.element-ZD_n4ObO.js +0 -73
  77. package/number.element-B0E7W2TK.js +0 -70
  78. package/password.element-C4_eLdUO.js +0 -71
  79. package/radiogroup.element-BD8qBNoO.js +0 -68
  80. package/select.element-BLxtqB0A.js +0 -74
  81. package/textarea.element-DgDwfzYP.js +0 -70
  82. package/textinput.element-DSLFDjfb.js +0 -67
  83. package/toggle.element-BLu6F99u.js +0 -65
@@ -0,0 +1,282 @@
1
+ import { InputWidgetAdapter as y, formContext as v, inputContext as $ } from "@golemui/lit";
2
+ import "@golemui/gui-shared";
3
+ import { LitElement as m, nothing as n, html as c } from "lit";
4
+ import { property as s, customElement as b } from "lit/decorators.js";
5
+ import { G as f, b as g, c as x } from "./templates-Dk1jxLwS.js";
6
+ import { styleMap as w } from "lit-html/directives/style-map.js";
7
+ import { consume as D, provide as C } from "@lit/context";
8
+ import "rxjs";
9
+ var N = Object.defineProperty, E = Object.getOwnPropertyDescriptor, r = (t, i, e, o) => {
10
+ for (var u = o > 1 ? void 0 : o ? E(i, e) : i, l = t.length - 1, p; l >= 0; l--)
11
+ (p = t[l]) && (u = (o ? p(i, e, u) : p(u)) || u);
12
+ return o && u && N(i, e, u), u;
13
+ };
14
+ let a = class extends m {
15
+ constructor() {
16
+ super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.step = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimum = void 0, this.maximum = void 0, this.autoGrow = !1, this.ariaController = new f(this, {
17
+ getTargets: () => this.querySelectorAll(`input[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
+ }
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 = this.querySelector(`input[id="${this.uid}"]`), i = {
39
+ "min-width": "23px"
40
+ };
41
+ if (this.autoGrow)
42
+ if (t) {
43
+ t.style.width = "0px";
44
+ const o = Math.max(23, t.scrollWidth);
45
+ i.width = `${o}px`, i.maxWidth = `${o}px`, t.style.width = "";
46
+ } else
47
+ i.width = "47px";
48
+ const e = {
49
+ uid: this.uid,
50
+ label: this.label,
51
+ hint: this.hint,
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
+ step: this.step,
59
+ placeholder: this.placeholder,
60
+ autocomplete: this.autocomplete
61
+ };
62
+ return c`
63
+ ${g(this.uid, e)}
64
+
65
+ <div class="gui-widget">
66
+ <button
67
+ type="button"
68
+ tabindex="-1"
69
+ class="gui-button gui-number__minus"
70
+ ?disabled=${this.value <= this.minimum || this.disabled}
71
+ @click=${this.minus}
72
+ >
73
+ -
74
+ </button>
75
+
76
+ <input
77
+ type="number"
78
+ inputmode="decimal"
79
+ id=${this.uid}
80
+ data-cy=${`${this.uid}_number`}
81
+ style=${w(i)}
82
+ value=${this.value}
83
+ ?required=${this.required}
84
+ ?disabled=${this.disabled}
85
+ ?readonly=${this.readOnly}
86
+ step=${typeof this.step == "number" ? this.step : n}
87
+ placeholder=${this.placeholder || n}
88
+ autocomplete=${this.autocomplete || n}
89
+ @input=${this.valueChanged}
90
+ @keydown=${this.keyDown}
91
+ @blur=${this.onBlur}
92
+ />
93
+
94
+ <button
95
+ type="button"
96
+ tabindex="-1"
97
+ class="gui-button gui-number__plus"
98
+ ?disabled=${this.value >= this.maximum || this.disabled}
99
+ @click=${this.plus}
100
+ >
101
+ +
102
+ </button>
103
+ </div>
104
+
105
+ ${x(this.uid, e)}
106
+ `;
107
+ }
108
+ keyDown(t) {
109
+ switch (t.stopPropagation(), t.key) {
110
+ case "ArrowUp":
111
+ t.preventDefault(), this.plus();
112
+ break;
113
+ case "ArrowDown":
114
+ t.preventDefault(), this.minus();
115
+ break;
116
+ }
117
+ }
118
+ minus() {
119
+ if (!this.readOnly) {
120
+ const t = this.querySelector(`input[id="${this.uid}"]`), i = typeof this.step == "number" ? this.step : 1;
121
+ let e = Number(t.valueAsNumber) || Number(t.valueAsNumber) === 0 ? t.valueAsNumber - i : 1;
122
+ e = Number(this.maximum) ? Math.min(e, this.maximum) : e, e = Number(this.minimum) ? Math.max(e, this.minimum) : e, t.valueAsNumber = e, this.value = e, this.dispatchEvent(
123
+ new CustomEvent("input", {
124
+ detail: { value: this.value },
125
+ bubbles: !0,
126
+ composed: !0
127
+ })
128
+ );
129
+ }
130
+ }
131
+ plus() {
132
+ if (!this.readOnly) {
133
+ const t = this.querySelector(`input[id="${this.uid}"]`), i = typeof this.step == "number" ? this.step : 1;
134
+ let e = Number(t.valueAsNumber) || Number(t.valueAsNumber) === 0 ? t.valueAsNumber + i : 1;
135
+ e = Number(this.maximum) ? Math.min(e, this.maximum) : e, e = Number(this.minimum) ? Math.max(e, this.minimum) : e, t.valueAsNumber = e, this.value = e, this.dispatchEvent(
136
+ new CustomEvent("input", {
137
+ detail: { value: this.value },
138
+ bubbles: !0,
139
+ composed: !0
140
+ })
141
+ );
142
+ }
143
+ }
144
+ valueChanged(t) {
145
+ if (t.stopPropagation(), !this.readOnly) {
146
+ const i = t.target;
147
+ this.dispatchEvent(
148
+ new CustomEvent("input", {
149
+ detail: { value: i.valueAsNumber },
150
+ bubbles: !0,
151
+ composed: !0
152
+ })
153
+ );
154
+ }
155
+ }
156
+ onBlur() {
157
+ this.dispatchEvent(
158
+ new CustomEvent("blur", {
159
+ bubbles: !0,
160
+ composed: !0
161
+ })
162
+ );
163
+ }
164
+ };
165
+ r([
166
+ s({ type: String })
167
+ ], a.prototype, "uid", 2);
168
+ r([
169
+ s({ type: String })
170
+ ], a.prototype, "label", 2);
171
+ r([
172
+ s({ type: String })
173
+ ], a.prototype, "hint", 2);
174
+ r([
175
+ s({ type: String, attribute: "locale-id" })
176
+ ], a.prototype, "localeId", 2);
177
+ r([
178
+ s({ type: Array })
179
+ ], a.prototype, "errors", 2);
180
+ r([
181
+ s({ type: Boolean })
182
+ ], a.prototype, "touched", 2);
183
+ r([
184
+ s({ type: Boolean })
185
+ ], a.prototype, "required", 2);
186
+ r([
187
+ s({ type: Boolean })
188
+ ], a.prototype, "disabled", 2);
189
+ r([
190
+ s({ type: Boolean, attribute: "readonly" })
191
+ ], a.prototype, "readOnly", 2);
192
+ r([
193
+ s({ type: Number })
194
+ ], a.prototype, "value", 2);
195
+ r([
196
+ s({ type: Number })
197
+ ], a.prototype, "step", 2);
198
+ r([
199
+ s({ type: String })
200
+ ], a.prototype, "placeholder", 2);
201
+ r([
202
+ s({ type: String })
203
+ ], a.prototype, "autocomplete", 2);
204
+ r([
205
+ s({ type: Number })
206
+ ], a.prototype, "minimum", 2);
207
+ r([
208
+ s({ type: Number })
209
+ ], a.prototype, "maximum", 2);
210
+ r([
211
+ s({ type: Number })
212
+ ], a.prototype, "autoGrow", 2);
213
+ a = r([
214
+ b("gui-number")
215
+ ], a);
216
+ typeof customElements < "u" && !customElements.get("gui-number") && customElements.define("gui-number", a);
217
+ var _ = Object.defineProperty, O = Object.getOwnPropertyDescriptor, h = (t, i, e, o) => {
218
+ for (var u = o > 1 ? void 0 : o ? O(i, e) : i, l = t.length - 1, p; l >= 0; l--)
219
+ (p = t[l]) && (u = (o ? p(i, e, u) : p(u)) || u);
220
+ return o && u && _(i, e, u), u;
221
+ };
222
+ let d = class extends m {
223
+ constructor() {
224
+ super(...arguments), this.adapter = new y(), this.subscriptions = [];
225
+ }
226
+ createRenderRoot() {
227
+ return this;
228
+ }
229
+ updated(t) {
230
+ super.updated(t);
231
+ const i = this.adapter.templateData.size;
232
+ i ? this.style.flex = String(i) : this.style.removeProperty("flex");
233
+ }
234
+ connectedCallback() {
235
+ super.connectedCallback(), this.classList.add("gui-number", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
236
+ this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
237
+ );
238
+ }
239
+ render() {
240
+ return super.render(), c`
241
+ <gui-number
242
+ .uid=${this.widget.uid}
243
+ .label=${this.adapter.templateData.label}
244
+ .hint=${this.adapter.templateData.hint}
245
+ .errors=${this.adapter.templateData.errors}
246
+ ?touched=${this.adapter.templateData.touched}
247
+ ?required=${this.adapter.templateData.validator?.required}
248
+ ?disabled=${this.adapter.templateData.disabled}
249
+ ?readonly=${this.adapter.templateData.readonly}
250
+ .value=${this.adapter.templateData.value}
251
+ .step=${this.adapter.templateData.step}
252
+ .minimum=${this.adapter.templateData.minimum}
253
+ .maximum=${this.adapter.templateData.maximum}
254
+ .autoGrow=${this.adapter.templateData.autoGrow}
255
+ .placeholder=${this.adapter.templateData.placeholder}
256
+ .autocomplete=${this.adapter.templateData.autocomplete}
257
+ @input=${this.valueChanged}
258
+ @blur=${() => this.adapter.onBlur()}
259
+ ></gui-number>
260
+ `;
261
+ }
262
+ valueChanged(t) {
263
+ const i = t.detail.value;
264
+ this.adapter.valueChanged(i);
265
+ }
266
+ disconnectedCallback() {
267
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
268
+ }
269
+ };
270
+ h([
271
+ D({ context: v }),
272
+ s({ attribute: !1 })
273
+ ], d.prototype, "formContext", 2);
274
+ h([
275
+ C({ context: $ })
276
+ ], d.prototype, "adapter", 2);
277
+ d = h([
278
+ b("gui-number-input")
279
+ ], d);
280
+ export {
281
+ d as NumberElement
282
+ };
@@ -0,0 +1,48 @@
1
+ import { isOption as c } from "@golemui/gui-shared";
2
+ function l(e) {
3
+ const r = typeof e;
4
+ return r === "string" || r === "number";
5
+ }
6
+ function b(e, r) {
7
+ return r.find((t) => t.value.toString() === e)?.value;
8
+ }
9
+ const h = (e, r) => {
10
+ if (Array.isArray(e) && e.length > 0 && !c(e[0])) {
11
+ if (l(e[0]))
12
+ return e.map((t) => ({
13
+ label: t.toString(),
14
+ value: t
15
+ }));
16
+ if (u(e[0], r)) {
17
+ const t = f(e[0], r);
18
+ return e.map(t);
19
+ } else
20
+ throw new Error("Invalid option shape");
21
+ }
22
+ return e;
23
+ }, u = (e, { labelField: r, valueField: t }) => {
24
+ if (e === null || typeof e != "object")
25
+ return !1;
26
+ const n = e, o = r ? Object.prototype.hasOwnProperty.call(n, r) : !1, a = t ? Object.prototype.hasOwnProperty.call(n, t) : !1;
27
+ return r && !o ? !1 : !(t && !a);
28
+ };
29
+ function f(e, { labelField: r, valueField: t }) {
30
+ if (e === null || typeof e != "object")
31
+ throw new Error("Provided value is not an object");
32
+ const n = e, o = r && Object.prototype.hasOwnProperty.call(n, r) ? r : void 0, a = t && Object.prototype.hasOwnProperty.call(n, t) ? t : void 0;
33
+ if (!o && !a)
34
+ throw new Error("Neither labelField nor valueField exists on the object");
35
+ return (i) => {
36
+ if (i === null || typeof i != "object")
37
+ throw new Error("Item is not an object");
38
+ const s = i;
39
+ return {
40
+ label: o ? s[o] : "",
41
+ value: a ? s[a] : ""
42
+ };
43
+ };
44
+ }
45
+ export {
46
+ b as i,
47
+ h as u
48
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/gui-lit",
3
- "version": "0.12.2",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "main": "./index.umd.cjs",
6
6
  "module": "./index.js",
@@ -21,11 +21,11 @@
21
21
  "*.md"
22
22
  ],
23
23
  "peerDependencies": {
24
- "@golemui/lit": "0.12.2",
25
- "@golemui/core": "0.12.2",
26
- "@golemui/gui-components": "0.12.2",
27
- "@golemui/gui-shared": "0.12.2",
28
- "@golemui/gui-validators": "0.12.2",
24
+ "@golemui/lit": "0.13.1",
25
+ "@golemui/core": "0.13.1",
26
+ "@golemui/gui-components": "0.13.1",
27
+ "@golemui/gui-shared": "0.13.1",
28
+ "@golemui/gui-validators": "0.13.1",
29
29
  "@lit/context": "^1.1.6",
30
30
  "lit-html": "^3.3.1",
31
31
  "lit": "^3.3.1",
@@ -0,0 +1,238 @@
1
+ import { InputWidgetAdapter as m, formContext as y, inputContext as P } from "@golemui/lit";
2
+ import "@golemui/gui-shared";
3
+ import { LitElement as w, nothing as n, html as u } from "lit";
4
+ import { property as o, state as g, customElement as b } from "lit/decorators.js";
5
+ import { classMap as v } from "lit/directives/class-map.js";
6
+ import { G as $, a as f, b as I, c as C } from "./templates-Dk1jxLwS.js";
7
+ import { consume as D, provide as L } from "@lit/context";
8
+ import "rxjs";
9
+ var S = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, s = (t, a, i, d) => {
10
+ for (var r = d > 1 ? void 0 : d ? _(a, i) : a, l = t.length - 1, p; l >= 0; l--)
11
+ (p = t[l]) && (r = (d ? p(a, i, r) : p(r)) || r);
12
+ return d && r && S(a, i, r), r;
13
+ };
14
+ let e = class extends w {
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.icon = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.showPasswordIcon = void 0, this.hidePasswordIcon = void 0, this.showPasswordLabel = void 0, this.hidePasswordLabel = void 0, this.showPassword = !1, this.ariaController = new $(this, {
17
+ getTargets: () => this.querySelectorAll(`input[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
+ }
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
+ showPasswordIcon: this.showPasswordIcon,
52
+ hidePasswordIcon: this.hidePasswordIcon,
53
+ showPasswordLabel: this.showPasswordLabel,
54
+ hidePasswordLabel: this.hidePasswordLabel
55
+ }, a = f("password", t), i = {
56
+ "gui-password--icon": !!this.icon
57
+ };
58
+ return u`
59
+ ${I(this.uid, t)}
60
+
61
+ <div class="gui-widget">
62
+ <input
63
+ type=${this.showPassword ? "text" : "password"}
64
+ id=${this.uid}
65
+ data-cy=${`${this.uid}_password`}
66
+ class=${v(i)}
67
+ value=${this.value}
68
+ ?required=${this.disabled}
69
+ ?disabled=${this.disabled}
70
+ ?readonly=${this.readOnly}
71
+ placeholder=${this.placeholder || n}
72
+ autocomplete=${this.autocomplete || n}
73
+ @input=${this.valueChanged}
74
+ @blur=${this.onBlur}
75
+ />
76
+ ${a.html}
77
+ <button
78
+ class=${`gui-password__toggle gui-widget-icon ${this.showPassword && t.showPasswordIcon ? t.showPasswordIcon : ""} ${!this.showPassword && t.hidePasswordIcon ? t.hidePasswordIcon : ""}`}
79
+ data-icon=${this.showPassword ? t.showPasswordIcon : t.hidePasswordIcon}
80
+ type="button"
81
+ tabindex="-1"
82
+ @click=${() => this.showPassword = !this.showPassword}
83
+ >
84
+ ${t.showPasswordIcon || t.hidePasswordIcon ? n : u`<span
85
+ >${this.showPassword ? t.hidePasswordLabel ?? "Hide" : t.showPasswordLabel ?? "Show"}</span
86
+ >`}
87
+ </button>
88
+ </div>
89
+
90
+ ${C(this.uid, t)}
91
+ `;
92
+ }
93
+ valueChanged(t) {
94
+ if (t.stopPropagation(), !this.readOnly) {
95
+ const a = t.target;
96
+ this.dispatchEvent(
97
+ new CustomEvent("input", {
98
+ detail: { value: a.value },
99
+ bubbles: !0,
100
+ composed: !0
101
+ })
102
+ );
103
+ }
104
+ }
105
+ onBlur() {
106
+ this.dispatchEvent(
107
+ new CustomEvent("blur", {
108
+ bubbles: !0,
109
+ composed: !0
110
+ })
111
+ );
112
+ }
113
+ };
114
+ s([
115
+ o({ type: String })
116
+ ], e.prototype, "uid", 2);
117
+ s([
118
+ o({ type: String })
119
+ ], e.prototype, "label", 2);
120
+ s([
121
+ o({ type: String, attribute: "locale-id" })
122
+ ], e.prototype, "localeId", 2);
123
+ s([
124
+ o({ type: Array })
125
+ ], e.prototype, "errors", 2);
126
+ s([
127
+ o({ type: Boolean })
128
+ ], e.prototype, "touched", 2);
129
+ s([
130
+ o({ type: Boolean })
131
+ ], e.prototype, "required", 2);
132
+ s([
133
+ o({ type: Boolean })
134
+ ], e.prototype, "disabled", 2);
135
+ s([
136
+ o({ type: Boolean, attribute: "readonly" })
137
+ ], e.prototype, "readOnly", 2);
138
+ s([
139
+ o({ type: String })
140
+ ], e.prototype, "value", 2);
141
+ s([
142
+ o({ type: String })
143
+ ], e.prototype, "hint", 2);
144
+ s([
145
+ o({ type: String })
146
+ ], e.prototype, "icon", 2);
147
+ s([
148
+ o({ type: String })
149
+ ], e.prototype, "placeholder", 2);
150
+ s([
151
+ o({ type: String })
152
+ ], e.prototype, "autocomplete", 2);
153
+ s([
154
+ o({ type: String })
155
+ ], e.prototype, "showPasswordIcon", 2);
156
+ s([
157
+ o({ type: String })
158
+ ], e.prototype, "hidePasswordIcon", 2);
159
+ s([
160
+ o({ type: String })
161
+ ], e.prototype, "showPasswordLabel", 2);
162
+ s([
163
+ o({ type: String })
164
+ ], e.prototype, "hidePasswordLabel", 2);
165
+ s([
166
+ g()
167
+ ], e.prototype, "showPassword", 2);
168
+ e = s([
169
+ b("gui-password")
170
+ ], e);
171
+ typeof customElements < "u" && !customElements.get("gui-password") && customElements.define("gui-password", e);
172
+ var x = Object.defineProperty, O = Object.getOwnPropertyDescriptor, c = (t, a, i, d) => {
173
+ for (var r = d > 1 ? void 0 : d ? O(a, i) : a, l = t.length - 1, p; l >= 0; l--)
174
+ (p = t[l]) && (r = (d ? p(a, i, r) : p(r)) || r);
175
+ return d && r && x(a, i, r), r;
176
+ };
177
+ let h = class extends w {
178
+ constructor() {
179
+ super(...arguments), this.adapter = new m(), this.subscriptions = [];
180
+ }
181
+ createRenderRoot() {
182
+ return this;
183
+ }
184
+ updated(t) {
185
+ super.updated(t);
186
+ const a = this.adapter.templateData.size;
187
+ a ? this.style.flex = String(a) : this.style.removeProperty("flex");
188
+ }
189
+ connectedCallback() {
190
+ super.connectedCallback(), this.classList.add("gui-password", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
191
+ this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
192
+ );
193
+ }
194
+ render() {
195
+ return super.render(), u`
196
+ <gui-password
197
+ .uid=${this.widget.uid}
198
+ .label=${this.adapter.templateData.label}
199
+ .hint=${this.adapter.templateData.hint}
200
+ .errors=${this.adapter.templateData.errors}
201
+ ?touched=${this.adapter.templateData.touched}
202
+ ?required=${this.adapter.templateData.validator?.required}
203
+ ?disabled=${this.adapter.templateData.disabled}
204
+ ?readonly=${this.adapter.templateData.readonly}
205
+ .value=${this.adapter.templateData.value}
206
+ .icon=${this.adapter.templateData.icon}
207
+ .placeholder=${this.adapter.templateData.placeholder}
208
+ .autocomplete=${this.adapter.templateData.autocomplete}
209
+ .showPasswordIcon=${this.adapter.templateData.showPasswordIcon}
210
+ .hidePasswordIcon=${this.adapter.templateData.hidePasswordIcon}
211
+ .showPasswordLabel=${this.adapter.templateData.showPasswordLabel}
212
+ .hidePasswordLabel=${this.adapter.templateData.hidePasswordLabel}
213
+ @input=${this.valueChanged}
214
+ @blur=${() => this.adapter.onBlur()}
215
+ ></gui-password>
216
+ `;
217
+ }
218
+ valueChanged(t) {
219
+ const a = t.detail.value;
220
+ this.adapter.valueChanged(a);
221
+ }
222
+ disconnectedCallback() {
223
+ super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
224
+ }
225
+ };
226
+ c([
227
+ D({ context: y }),
228
+ o({ attribute: !1 })
229
+ ], h.prototype, "formContext", 2);
230
+ c([
231
+ L({ context: P })
232
+ ], h.prototype, "adapter", 2);
233
+ h = c([
234
+ b("gui-password-input")
235
+ ], h);
236
+ export {
237
+ h as PasswordElement
238
+ };