@golemui/gui-lit 1.2.0 → 1.2.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/{accordion.element-BIgxl5e9.js → accordion.element-C9GzfKrY.js} +29 -30
  3. package/alert.element-CHn49Yaf.js +55 -0
  4. package/button.element-C9fHivSw.js +59 -0
  5. package/{calendar.element-Cv3RBphf.js → calendar.element-XkojKTJk.js} +30 -31
  6. package/checkbox.element-DU_tVMXu.js +66 -0
  7. package/currency.element-BmAH5KS_.js +73 -0
  8. package/date-picker.element-Bg3rF95F.js +94 -0
  9. package/{date-time-calendar.element-DlbWZjoe.js → date-time-calendar.element-sywQCeQQ.js} +24 -24
  10. package/date-time-picker.element-HHpwjWTQ.js +107 -0
  11. package/{date-time.element-CLLxM2nV.js → date-time.element-ucETvSTC.js} +26 -26
  12. package/{date.element-B8ZHK9KJ.js → date.element-BEHGxRFF.js} +27 -27
  13. package/default-list-item-renderer-CuPJ9jUD.js +24 -0
  14. package/{dropdown.element-DMZ7oL5n.js → dropdown.element-DUqG_p1x.js} +85 -84
  15. package/{flex.element-DG4Uaj_X.js → flex.element-pwba7621.js} +27 -28
  16. package/{grid.element-DCZsh-3J.js → grid.element-C8K7_Qi3.js} +29 -30
  17. package/index.js +1316 -3883
  18. package/index.umd.cjs +117 -2132
  19. package/{list.element-ADtUK2na.js → list.element-ZtEMKE2x.js} +41 -40
  20. package/markdown-text.element-DDm36qD0.js +54 -0
  21. package/markdown.element-DWz3U9rG.js +84 -0
  22. package/number.element-VkG5wScD.js +71 -0
  23. package/package.json +6 -6
  24. package/password.element-C5vQHq5P.js +72 -0
  25. package/radiogroup.element-CKdO9HwO.js +69 -0
  26. package/{range-calendar.element-D5eb2f7p.js → range-calendar.element-BznGrej5.js} +23 -24
  27. package/{range-date-input.element-C35grlYo.js → range-date-input.element-BloTHRDl.js} +24 -24
  28. package/range-date-picker.element-DKhwFasW.js +98 -0
  29. package/{range-date-time-calendar.element-BV0J96Gu.js → range-date-time-calendar.element-CZCET-sb.js} +26 -26
  30. package/{range-date-time-input.element-CzgRbR9F.js → range-date-time-input.element-Dr2VrYhG.js} +24 -24
  31. package/range-date-time-picker.element-CYeIMWLp.js +109 -0
  32. package/{range-time-input.element-BOHLUO8z.js → range-time-input.element-7OZhPQqx.js} +23 -23
  33. package/range-time-picker.element-D0mRFZkK.js +96 -0
  34. package/renderer.element-DbsFoBba.js +48 -0
  35. package/{repeater.element-Da8YN1Vy.js → repeater.element-DGEbwvhY.js} +54 -65
  36. package/select.element-Bb_9jAVB.js +76 -0
  37. package/{tabs.element-CvcIA8P3.js → tabs.element-BYDNF_pm.js} +49 -50
  38. package/tags.element-BSN3i9Gx.js +73 -0
  39. package/textarea.element-Dl1ZEOqO.js +71 -0
  40. package/textinput.element-C5Vbbkxq.js +68 -0
  41. package/{time-picker.element-C3oR0EkQ.js → time-picker.element-Crmj9YDy.js} +26 -26
  42. package/{time.element-X286nthD.js → time.element-DfSeAZp4.js} +29 -29
  43. package/toggle.element-ORsprZ2M.js +66 -0
  44. package/alert.element-DPWq9-0F.js +0 -56
  45. package/button.element-CJay43iR.js +0 -132
  46. package/calendar-DleRbmvP.js +0 -267
  47. package/checkbox.element-CpmrzdH0.js +0 -200
  48. package/currency.element-Cezgzbbs.js +0 -276
  49. package/date-DBuYpvcO.js +0 -849
  50. package/date-input-B3yHsn-g.js +0 -204
  51. package/date-picker.element-ByZefznr.js +0 -357
  52. package/date-time-calendar-CB5cNoOX.js +0 -374
  53. package/date-time-input-DrY68YDX.js +0 -246
  54. package/date-time-picker.element-CYwmumfq.js +0 -440
  55. package/day-status-ljexnwEO.js +0 -554
  56. package/errors-Bs_vYN-_.js +0 -110
  57. package/focus-leave.controller-2gV0pQd5.js +0 -73
  58. package/list-D730tmGN.js +0 -297
  59. package/markdown-text-X-BRJT6K.js +0 -30
  60. package/markdown-text.element-B8TfVLIO.js +0 -55
  61. package/markdown.element-D5zcxAUS.js +0 -693
  62. package/number.element-DEY5tR_y.js +0 -291
  63. package/numeric-jmOOKz30.js +0 -12
  64. package/one-of-anKkm7mD.js +0 -50
  65. package/part-templates-VORbpgs2.js +0 -691
  66. package/password.element-C1aQh_iz.js +0 -240
  67. package/pill-ranges-DpvWwP-3.js +0 -48
  68. package/pills-BDMO2NiR.js +0 -348
  69. package/popup.controller-B33OvX_y.js +0 -86
  70. package/radiogroup.element-B2G-XyGx.js +0 -235
  71. package/range-calendar-D7sG24Kx.js +0 -466
  72. package/range-commit-8-MmYUyo.js +0 -14
  73. package/range-date-input-BChaoBC1.js +0 -311
  74. package/range-date-picker.element-Do5YsL5V.js +0 -434
  75. package/range-date-time-calendar-DulGK2EQ.js +0 -734
  76. package/range-date-time-input-8ggqckP7.js +0 -353
  77. package/range-date-time-picker.element-hi5KdopZ.js +0 -472
  78. package/range-selection-CU3hxLJE.js +0 -25
  79. package/range-time-input-D7GFdDeA.js +0 -348
  80. package/range-time-picker.element-DDNQMA_u.js +0 -470
  81. package/renderer.element-CNyMn2Lu.js +0 -49
  82. package/select.element-SDxBhGjz.js +0 -266
  83. package/tabs-DzSCq_98.js +0 -13
  84. package/tags.element-Bnhfevp3.js +0 -369
  85. package/templates-Df7abEkB.js +0 -92
  86. package/textarea.element-Dx7eYEnl.js +0 -239
  87. package/textinput.element-BnIoDRmY.js +0 -205
  88. package/time-input-Kk4EX6at.js +0 -201
  89. package/time-list-DLcq8BAp.js +0 -217
  90. package/time-picker-DLj1rhOf.js +0 -299
  91. package/toggle.element-Dokdat_o.js +0 -203
@@ -1,299 +0,0 @@
1
- import { LitElement as h, html as u } from "lit";
2
- import { property as s, query as m, customElement as d } from "lit/decorators.js";
3
- import { classMap as g } from "lit/directives/class-map.js";
4
- import "./time-input-Kk4EX6at.js";
5
- import "./time-list-DLcq8BAp.js";
6
- import { G as c } from "./popup.controller-B33OvX_y.js";
7
- import { w as b, h as y, A as v } from "./part-templates-VORbpgs2.js";
8
- import { a as T, b as f, c as $ } from "./templates-Df7abEkB.js";
9
- import { e as w } from "./date-DBuYpvcO.js";
10
- var _ = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (e, o, r, a) => {
11
- for (var l = a > 1 ? void 0 : a ? A(o, r) : o, p = e.length - 1, n; p >= 0; p--)
12
- (n = e[p]) && (l = (a ? n(o, r, l) : n(l)) || l);
13
- return a && l && _(o, r, l), l;
14
- };
15
- let t = class extends h {
16
- constructor() {
17
- super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.toggleAriaLabel = void 0, this.hourAriaLabel = void 0, this.minuteAriaLabel = void 0, this.dayPeriodAriaLabel = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.localeId = void 0, this.value = void 0, this.hourFormat = void 0, this.minuteStep = void 0, this.minTime = void 0, this.maxTime = void 0, this.disabledRanges = void 0, this.allowCustomTime = !1, this.height = void 0, this.itemHeight = void 0, this.columns = void 0, this.minTimeMessage = void 0, this.maxTimeMessage = void 0, this.disabledRangeMessage = void 0, this.noAvailableTimesMessage = void 0, this._popup = new c(this, {
18
- focusRestoreSelector: "gui-time input, gui-time button",
19
- focusPopupSelector: '.gui-time-list__option[tabindex="0"]',
20
- isDisabled: () => !!this.disabled,
21
- clickIntent: (e) => e.closest(".gui-time-list__option") ? "ignore" : e.closest("gui-time") || e.closest("gui-time-list") ? "open" : "toggle",
22
- keyToggleMode: "openClose",
23
- onOpenChanged: (e) => {
24
- this.dispatchListToggle(e), e && this.updateComplete.then(() => this._listRef?.scrollToSelectedValue());
25
- }
26
- }), this.onToggleClick = (e) => {
27
- e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
28
- }, this.onKeyDown = (e) => {
29
- if (this._popup.onAnchorKeyDown(e)) return;
30
- if (e.key === "Enter" && e.target.closest("gui-time")) {
31
- this._popup.open && this._popup.close(), this.commitValue(this.value, !0);
32
- return;
33
- }
34
- this.allowCustomTime || this.readOnly || this.disabled || e.key !== "ArrowDown" && e.key !== "ArrowUp" || !e.target.closest("gui-time") || (e.preventDefault(), this.selectAdjacentOption(e.key === "ArrowDown" ? 1 : -1));
35
- };
36
- }
37
- createRenderRoot() {
38
- return this;
39
- }
40
- updated(e) {
41
- e.has("value") && this._listRef && this._listRef.value !== this.value && (this._listRef.value = this.value);
42
- }
43
- render() {
44
- const e = T("timePicker", { icon: this.icon });
45
- return u`
46
- ${f(
47
- this.uid ?? "",
48
- {
49
- label: this.label,
50
- hint: this.hint,
51
- required: this.required
52
- },
53
- !1,
54
- void 0,
55
- !1
56
- )}
57
-
58
- <div class="gui-widget" @keydown=${this.onKeyDown} @click=${this._popup.onAnchorClick}>
59
- <gui-time
60
- id="time-input"
61
- class=${g(e.widgetClasses)}
62
- .uid=${this.uid}
63
- .hint=${this.hint}
64
- .showErrors=${!1}
65
- .errors=${this.errors}
66
- ?touched=${this.touched}
67
- ?required=${this.required}
68
- ?disabled=${this.disabled}
69
- ?readonly=${this.readOnly || !this.allowCustomTime}
70
- .value=${this.value}
71
- .icon=${this.icon}
72
- .localeId=${this.localeId}
73
- .hourFormat=${this.hourFormat}
74
- .minuteStep=${this.minuteStep}
75
- .minTime=${this.minTime}
76
- .maxTime=${this.maxTime}
77
- .hourAriaLabel=${this.hourAriaLabel}
78
- .minuteAriaLabel=${this.minuteAriaLabel}
79
- .dayPeriodAriaLabel=${this.dayPeriodAriaLabel}
80
- .minTimeMessage=${this.minTimeMessage}
81
- .maxTimeMessage=${this.maxTimeMessage}
82
- @blur=${this.onTimeBlur}
83
- @focus=${this._popup.show}
84
- @change=${this.onTimeChange}
85
- ></gui-time>
86
- <button
87
- type="button"
88
- class="gui-time-picker__arrow"
89
- aria-label=${this.toggleAriaLabel ?? "Show time list"}
90
- aria-haspopup="dialog"
91
- aria-expanded=${this._popup.open ? "true" : "false"}
92
- aria-controls=${`${this.uid}_popup`}
93
- ?disabled=${this.disabled}
94
- @click=${this.onToggleClick}
95
- >
96
- <svg
97
- xmlns="http://www.w3.org/2000/svg"
98
- width="16"
99
- height="16"
100
- viewBox="0 0 256 256"
101
- aria-hidden="true"
102
- >
103
- <path
104
- 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"
105
- ></path>
106
- </svg>
107
- </button>
108
-
109
- <gui-time-list
110
- id=${`${this.uid}_popup`}
111
- role="dialog"
112
- aria-label=${this.label ?? "Time list"}
113
- .uid=${this.uid}
114
- .value=${this.value}
115
- .label=${this.label}
116
- .localeId=${this.localeId}
117
- .hourFormat=${this.hourFormat}
118
- .minuteStep=${this.minuteStep}
119
- .minTime=${this.minTime}
120
- .maxTime=${this.maxTime}
121
- .disabledRanges=${this.disabledRanges}
122
- .height=${this.height}
123
- .itemHeight=${this.itemHeight}
124
- .columns=${this.columns}
125
- .noAvailableTimesMessage=${this.noAvailableTimesMessage}
126
- ?readonly=${this.readOnly}
127
- ?hidden=${!this._popup.open}
128
- @change=${this.onListChange}
129
- ></gui-time-list>
130
- </div>
131
-
132
- ${this.showErrors ? $(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
133
- `;
134
- }
135
- onTimeChange(e) {
136
- e.stopPropagation(), this.commitValue(e.detail.value);
137
- }
138
- onTimeBlur() {
139
- this.dispatchEvent(new CustomEvent("blur"));
140
- }
141
- onListChange(e) {
142
- e.stopPropagation(), this.commitValue(e.detail.value, !0), this._popup.restoreFocusToInput(), this._popup.close();
143
- }
144
- /**
145
- * @param commit Marks the change as a deliberate final selection (list pick
146
- * or Enter) as opposed to continuous field editing (typing/arrows). A host
147
- * popover (the date-time calendar) closes only on a committed change, so
148
- * editing the time in place doesn't dismiss it mid-entry.
149
- */
150
- commitValue(e, o = !1) {
151
- this.value = e ?? void 0;
152
- const r = this.validateBounds(this.value);
153
- this.dispatchEvent(
154
- new CustomEvent("change", {
155
- detail: { value: e ?? null, commit: o },
156
- bubbles: !0,
157
- composed: !0
158
- })
159
- ), r && this.dispatchEvent(
160
- new CustomEvent("inputError", {
161
- detail: { message: r },
162
- bubbles: !0,
163
- composed: !0
164
- })
165
- );
166
- }
167
- validateBounds(e) {
168
- if (!e) return null;
169
- const o = b(e, {
170
- minTime: this.minTime,
171
- maxTime: this.maxTime,
172
- minTimeMessage: this.minTimeMessage,
173
- maxTimeMessage: this.maxTimeMessage
174
- });
175
- return o || (y(e, this.disabledRanges) ? this.disabledRangeMessage ?? w : null);
176
- }
177
- selectAdjacentOption(e) {
178
- const o = v({
179
- minTime: this.minTime,
180
- maxTime: this.maxTime,
181
- minuteStep: this.minuteStep,
182
- disabledRanges: this.disabledRanges
183
- });
184
- if (!o.length) return;
185
- const r = o.findIndex((l) => l.value === this.value);
186
- let a = r === -1 ? e === 1 ? 0 : o.length - 1 : r + e;
187
- for (; a >= 0 && a < o.length && o[a].disabled; )
188
- a += e;
189
- a < 0 || a >= o.length || (this.commitValue(o[a].value), this._popup.show(), this.updateComplete.then(() => this._listRef?.scrollToSelectedValue()));
190
- }
191
- /** Public close hook kept for the date-time calendars, which close the
192
- * embedded time-picker's list imperatively. */
193
- closeList() {
194
- this._popup.close();
195
- }
196
- dispatchListToggle(e) {
197
- this.dispatchEvent(
198
- new CustomEvent("listtoggle", {
199
- detail: { open: e },
200
- bubbles: !0,
201
- composed: !0
202
- })
203
- );
204
- }
205
- };
206
- i([
207
- s({ type: String })
208
- ], t.prototype, "uid", 2);
209
- i([
210
- s({ type: String })
211
- ], t.prototype, "label", 2);
212
- i([
213
- s({ type: String })
214
- ], t.prototype, "hint", 2);
215
- i([
216
- s({ type: String })
217
- ], t.prototype, "icon", 2);
218
- i([
219
- s({ type: String, attribute: "toggle-aria-label" })
220
- ], t.prototype, "toggleAriaLabel", 2);
221
- i([
222
- s({ type: String })
223
- ], t.prototype, "hourAriaLabel", 2);
224
- i([
225
- s({ type: String })
226
- ], t.prototype, "minuteAriaLabel", 2);
227
- i([
228
- s({ type: String })
229
- ], t.prototype, "dayPeriodAriaLabel", 2);
230
- i([
231
- s({ type: Array })
232
- ], t.prototype, "errors", 2);
233
- i([
234
- s({ type: Boolean })
235
- ], t.prototype, "showErrors", 2);
236
- i([
237
- s({ type: Boolean })
238
- ], t.prototype, "touched", 2);
239
- i([
240
- s({ type: Boolean })
241
- ], t.prototype, "required", 2);
242
- i([
243
- s({ type: Boolean })
244
- ], t.prototype, "disabled", 2);
245
- i([
246
- s({ type: Boolean, attribute: "readonly" })
247
- ], t.prototype, "readOnly", 2);
248
- i([
249
- s({ type: String, attribute: "locale-id" })
250
- ], t.prototype, "localeId", 2);
251
- i([
252
- s({ type: String })
253
- ], t.prototype, "value", 2);
254
- i([
255
- s({ type: String, attribute: "hour-format" })
256
- ], t.prototype, "hourFormat", 2);
257
- i([
258
- s({ type: Number, attribute: "minute-step" })
259
- ], t.prototype, "minuteStep", 2);
260
- i([
261
- s({ type: String, attribute: "min-time" })
262
- ], t.prototype, "minTime", 2);
263
- i([
264
- s({ type: String, attribute: "max-time" })
265
- ], t.prototype, "maxTime", 2);
266
- i([
267
- s({ type: Array, attribute: "disabled-ranges" })
268
- ], t.prototype, "disabledRanges", 2);
269
- i([
270
- s({ type: Boolean, attribute: "allow-custom-time" })
271
- ], t.prototype, "allowCustomTime", 2);
272
- i([
273
- s({ type: Number })
274
- ], t.prototype, "height", 2);
275
- i([
276
- s({ type: Number, attribute: "item-height" })
277
- ], t.prototype, "itemHeight", 2);
278
- i([
279
- s({ type: Number })
280
- ], t.prototype, "columns", 2);
281
- i([
282
- s({ type: String, attribute: "min-time-message" })
283
- ], t.prototype, "minTimeMessage", 2);
284
- i([
285
- s({ type: String, attribute: "max-time-message" })
286
- ], t.prototype, "maxTimeMessage", 2);
287
- i([
288
- s({ type: String, attribute: "disabled-range-message" })
289
- ], t.prototype, "disabledRangeMessage", 2);
290
- i([
291
- s({ type: String, attribute: "no-available-times-message" })
292
- ], t.prototype, "noAvailableTimesMessage", 2);
293
- i([
294
- m("gui-time-list")
295
- ], t.prototype, "_listRef", 2);
296
- t = i([
297
- d("gui-time-picker")
298
- ], t);
299
- typeof customElements < "u" && !customElements.get("gui-time-picker") && customElements.define("gui-time-picker", t);
@@ -1,203 +0,0 @@
1
- import { InputWidgetAdapter as b, formContext as m, inputContext as y } from "@golemui/lit";
2
- import { G as v, r as f, c as $ } from "./templates-Df7abEkB.js";
3
- import { LitElement as h, nothing as C, html as g } from "lit";
4
- import { property as a, customElement as c } from "lit/decorators.js";
5
- import { consume as _, provide as D } from "@lit/context";
6
- import "rxjs";
7
- var P = Object.defineProperty, w = Object.getOwnPropertyDescriptor, s = (t, e, l, o) => {
8
- for (var i = o > 1 ? void 0 : o ? w(e, l) : e, d = t.length - 1, n; d >= 0; d--)
9
- (n = t[d]) && (i = (o ? n(e, l, i) : n(i)) || i);
10
- return o && i && P(e, l, i), i;
11
- };
12
- let r = class extends h {
13
- constructor() {
14
- 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.togglePosition = "left", this.ariaController = new v(this, {
15
- getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
16
- getState: () => ({
17
- uid: this.uid,
18
- templateData: {
19
- hint: this.hint,
20
- errors: this.errors,
21
- touched: this.touched,
22
- // Checkboxes can't have aria-readonly
23
- readonly: !1,
24
- disabled: !1,
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
- togglePosition: this.togglePosition
49
- };
50
- return t.togglePosition === "right" ? this.classList.add("gui-toggle--right") : this.classList.contains("gui-toggle--right") && this.classList.remove("gui-toggle--right"), g`
51
- <label
52
- class="gui-label"
53
- for=${this.uid}
54
- data-cy=${`${this.uid}_label`}
55
- id=${`${this.uid}_label`}
56
- >
57
- <div class="gui-widget gui-widget--horizontal gui-toggle--switch">
58
- <input
59
- type="checkbox"
60
- role="switch"
61
- id=${this.uid}
62
- data-cy=${`${this.uid}_toggle`}
63
- ?checked=${t.value}
64
- ?required=${t.required}
65
- ?disabled=${t.disabled || t.readonly}
66
- @change=${this.valueChanged}
67
- @blur=${this.onBlur}
68
- />
69
-
70
- <span class="gui-toggle--slider" role="presentation"></span>
71
- </div>
72
-
73
- <span class="gui-label__container">
74
- <span class="gui-label__text"
75
- >${t.label}${f(t.required)}</span
76
- >
77
- </span>
78
- </label>
79
-
80
- <div class="gui-widget-hint" id=${`${t.uid}_hint`}>
81
- ${t.hint ?? C} ${$(this.uid, t)}
82
- </div>
83
- `;
84
- }
85
- valueChanged(t) {
86
- if (t?.stopPropagation(), !this.readOnly) {
87
- const e = t?.target;
88
- this.dispatchEvent(
89
- new CustomEvent("change", {
90
- detail: { value: e.checked },
91
- bubbles: !0,
92
- composed: !0
93
- })
94
- );
95
- }
96
- }
97
- onBlur() {
98
- this.dispatchEvent(
99
- new CustomEvent("blur", {
100
- bubbles: !0,
101
- composed: !0
102
- })
103
- );
104
- }
105
- };
106
- s([
107
- a({ type: String })
108
- ], r.prototype, "uid", 2);
109
- s([
110
- a({ type: String })
111
- ], r.prototype, "label", 2);
112
- s([
113
- a({ type: String, attribute: "locale-id" })
114
- ], r.prototype, "localeId", 2);
115
- s([
116
- a({ type: Array })
117
- ], r.prototype, "errors", 2);
118
- s([
119
- a({ type: Boolean })
120
- ], r.prototype, "touched", 2);
121
- s([
122
- a({ type: Boolean })
123
- ], r.prototype, "required", 2);
124
- s([
125
- a({ type: Boolean })
126
- ], r.prototype, "disabled", 2);
127
- s([
128
- a({ type: Boolean, attribute: "readonly" })
129
- ], r.prototype, "readOnly", 2);
130
- s([
131
- a({ type: String })
132
- ], r.prototype, "value", 2);
133
- s([
134
- a({ type: String })
135
- ], r.prototype, "hint", 2);
136
- s([
137
- a({ type: String })
138
- ], r.prototype, "togglePosition", 2);
139
- r = s([
140
- c("gui-toggle")
141
- ], r);
142
- typeof customElements < "u" && !customElements.get("gui-toggle") && customElements.define("gui-toggle", r);
143
- var q = Object.defineProperty, x = Object.getOwnPropertyDescriptor, p = (t, e, l, o) => {
144
- for (var i = o > 1 ? void 0 : o ? x(e, l) : e, d = t.length - 1, n; d >= 0; d--)
145
- (n = t[d]) && (i = (o ? n(e, l, i) : n(i)) || i);
146
- return o && i && q(e, l, i), i;
147
- };
148
- let u = class extends h {
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-toggle", "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(), g`
167
- <gui-toggle
168
- .uid=${this.widget.uid}
169
- .label=${this.adapter.templateData.label}
170
- .errors=${this.adapter.templateData.errors}
171
- ?touched=${this.adapter.templateData.touched}
172
- ?required=${this.adapter.templateData.validator?.required}
173
- ?disabled=${this.adapter.templateData.disabled}
174
- ?readonly=${this.adapter.templateData.readonly}
175
- .value=${this.adapter.templateData.value}
176
- .hint=${this.adapter.templateData.hint}
177
- .togglePosition=${this.adapter.templateData.togglePosition}
178
- @change=${this.valueChanged}
179
- @blur=${() => this.adapter.onBlur()}
180
- ></gui-toggle>
181
- `;
182
- }
183
- valueChanged(t) {
184
- const e = t.detail.value;
185
- this.adapter.valueChanged(e);
186
- }
187
- disconnectedCallback() {
188
- super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
189
- }
190
- };
191
- p([
192
- _({ context: m }),
193
- a({ attribute: !1 })
194
- ], u.prototype, "formContext", 2);
195
- p([
196
- D({ context: y })
197
- ], u.prototype, "adapter", 2);
198
- u = p([
199
- c("gui-toggle-input")
200
- ], u);
201
- export {
202
- u as ToggleElement
203
- };